Skip to content

Commit e8ae32b

Browse files
committed
add dev setup
1 parent f87a284 commit e8ae32b

File tree

1 file changed

+64
-13
lines changed

1 file changed

+64
-13
lines changed

README.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,78 @@ A plugin for deploying Django projects to PythonAnywhere, using django-simple-de
44

55
For full documentation, see the documentation for [django-simple-deploy](https://django-simple-deploy.readthedocs.io/en/latest/).
66

7+
## Quickstart
8+
9+
Deployment to [PythonAnywhere](https://www.pythonanywhere.com/) with this plugin
10+
requires a few prerequisites:
11+
12+
- You must use Git to track your project and push your code to a remote
13+
repository (e.g. GitHub, GitLab, Bitbucket).
14+
- You must track dependencies with a `requirements.txt` file.
15+
- Create a PythonAnywhere [Beginner account](https://www.pythonanywhere.com/registration/register/beginner/),
16+
which is a limited account with one web app, but requires no credit card.
17+
- Generate an [API token](https://help.pythonanywhere.com/pages/GettingYourAPIToken)
18+
- Ideally, stay logged in to PythonAnywhere in your default browser to make the
19+
first deployment smoother.
20+
721
## Plugin Development
822

9-
To set up a development environment for working on this plugin alongside `django-simple-deploy`, follow these steps:
23+
To set up a development environment for working on this plugin alongside
24+
`django-simple-deploy`, follow these steps.
25+
26+
1. Create a parent directory to hold your development work:
1027

1128
```sh
12-
# Create parent dir to hold development work
1329
mkdir dsd-dev
1430
cd dsd-dev/
31+
```
32+
33+
2. Clone `dsd-pythonanywhere` for development:
34+
35+
```sh
36+
# Clone dsd-pythonanywhere for development (and switch to branch being worked on)
37+
git clone [email protected]:caktus/dsd-pythonanywhere.git --branch add-api-client
38+
```
1539

16-
# Clone dsd-pythonanywhere for development
17-
git clone [email protected]:caktus/dsd-pythonanywhere.git
18-
cd dsd-pythonanywhere/
19-
# switch to branch being worked on
20-
git checkout add-api-client
40+
3. Clone `django-simple-deploy` and create the blog sample project
2141

22-
# Clone django-simple-deploy and set up development environment
42+
```sh
2343
git clone [email protected]:django-simple-deploy/django-simple-deploy.git
2444
cd django-simple-deploy/
25-
uv venv
26-
uv pip install -e ".[dev]"
27-
uv add --editable "../[dev]"
28-
uv pip install -e "../dsd-pythonanywhere/[dev]"
29-
uv run pytest tests/unit_tests
45+
# Builds a copy of the sample project in parent dir for testing (../dsd-dev-project-[random_string]/)
46+
uv run python tests/e2e_tests/utils/build_dev_env.py
47+
```
48+
49+
4. Setup the development environment:
50+
51+
```sh
52+
cd ../
53+
cd dsd-dev-project-[random_string]/
54+
source .venv/bin/activate
55+
# Install dsd-pythonanywhere plugin in editable mode
56+
pip install -e "../dsd-pythonanywhere/[dev]"
57+
```
58+
59+
5. Create a [new public repository on GitHub](https://github.com/new).
60+
61+
6. Push the sample project to your new repository:
62+
63+
```sh
64+
git remote add origin [email protected]:[your_github_username]/[your_new_repo_name].git
65+
git branch -M main
66+
git push -u origin main
67+
```
68+
69+
7. Configure environment variables for PythonAnywhere API access:
70+
71+
```sh
72+
export API_USER=[your_pythonanywhere_username]
73+
export API_TOKEN=[your_pythonanywhere_api_token]
74+
```
75+
76+
8. You can now make changes to `dsd-pythonanywhere` in the cloned directory
77+
and test them by running deployments from the sample project:
78+
79+
```sh
80+
python manage.py deploy
3081
```

0 commit comments

Comments
 (0)