Skip to content

Commit fc00dab

Browse files
#5 #21 updates readme.
1 parent f62fd2e commit fc00dab

File tree

1 file changed

+38
-22
lines changed

1 file changed

+38
-22
lines changed

README.md

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,58 @@
33
[![PyPI](https://img.shields.io/pypi/v/pythonanywhere)](https://pypi.org/project/pythonanywhere/)
44
[![Downloads](https://pepy.tech/badge/pythonanywhere)](https://pepy.tech/project/pythonanywhere)
55

6-
# PythonAnywhere helper scripts
6+
# PythonAnywhere cli tool
77

8-
These scripts are designed to be run from PythonAnywhere consoles
8+
`pa` is a single command to manage PythonAnywhere services.
9+
10+
It is designed to be run from PythonAnywhere consoles, but many subcommands could be executed directly
11+
from the local machine (see [usage](#Usage) below).
912

1013
## Installing
14+
### On PythonAnywhere
15+
In PythonAnywhere bash console run:
16+
17+
pip3.9 install --user pythonanywhere
1118

12-
pip3.6 install --user pythonanywhere
19+
If there is no `python3.9` on your PythonAnywhere account,
20+
you should upgrade your account to the new system image.
21+
See [here](https://help.pythonanywhere.com/pages/ChangingSystemImage) how to do it.
22+
`pa` works with python 3.6, 3.7 and 3.8, but we recommend using the latest system image
23+
24+
### On your local machine
25+
Install `pythonanywhere` package from [PyPI](https://pypi.org/project/pythonanywhere/).
26+
We recommend using `pipx` if you want to use it only as a cli tool or the virtual environment
27+
if you want to use a programmatic interface in your own code.
1328

14-
If there is no `python3.6` on your PythonAnywhere account,
15-
you should contact [[email protected]](mailto:[email protected]) and ask for an upgrade.
16-
1729
## Usage
1830

1931
There are two ways to use that package. You can just run the scripts or use underlying api wrappers directly in your scripts.
2032

21-
There are scripts provided for dealing with web apps:
33+
### Command line interface
34+
35+
### Running `pa` on your local machine
36+
37+
`pa` expects the presence of some environmental variables that are provided when you run your code in PythonAnywere console.
38+
You need to provide them if you run `pa` on your local machine.
39+
40+
`API_TOKEN` You need to set it to allow `pa` to connect to [PythonAnywere API](https://help.pythonanywhere.com/pages/API).
41+
To get an API token log into PythonAnywhere, and go to the “Account” page using the link at the top right.
42+
Click on the “API token” tab and click the “Create a new API token” button to get your token.
43+
44+
`PYTHONANYWHERE_SITE` is used to connect to PythonAnywhere API and defaults to `www.pythonanywhere.com`,
45+
but you may need to set it to `eu.pythonanywhere.com` if you use our EU site.
2246

23-
* [pa_autoconfigure_django.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_autoconfigure_django.py)
24-
* [pa_create_webapp_with_virtualenv.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_create_webapp_with_virtualenv.py)
25-
* [pa_delete_webapp_logs.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_delete_webapp_logs.py)
26-
* [pa_install_webapp_letsencrypt_ssl.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_install_webapp_letsencrypt_ssl.py)
27-
* [pa_install_webapp_ssl.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_install_webapp_ssl.py)
28-
* [pa_reload_webapp.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_reload_webapp.py)
29-
* [pa_start_django_webapp_with_virtualenv.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_start_django_webapp_with_virtualenv.py)
47+
If your username on PythonAnywhere is different from the username on your local machine,
48+
you may need to set `USER` for the environment you run `pa` in.
3049

31-
and scheduled tasks:
50+
### Programmatic usage in your code
3251

33-
* [pa_create_scheduled_task.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_create_scheduled_task.py)
34-
* [pa_delete_scheduled_task.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_delete_scheduled_task.py)
35-
* [pa_get_scheduled_tasks_list.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_get_scheduled_tasks_list.py)
36-
* [pa_get_scheduled_task_specs.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_get_scheduled_task_specs.py)
37-
* [pa_update_scheduled_task.py](https://github.com/pythonanywhere/helper_scripts/blob/master/scripts/pa_update_scheduled_task.py)
52+
Take a look at [`pythonanywhere.task`](https://github.com/pythonanywhere/helper_scripts/blob/master/pythonanywhere/task.py)
53+
module and docstrings of `pythonanywhere.task.Task` class and its methods.
3854

39-
Run any of them with `--help` flag to get information about usage.
55+
### Legacy scripts
4056

41-
See the [blog post](https://blog.pythonanywhere.com/155/)
57+
Legacy [scripts](https://github.com/pythonanywhere/helper_scripts/blob/master/legacy.md) (separate for each action) are still available.
4258

4359
## Contributing
4460

0 commit comments

Comments
 (0)