A plugin for deploying Django projects to PythonAnywhere, using django-simple-deploy.
For full documentation, see the documentation for django-simple-deploy.
Current status: In active development. The plugin currently clones your repository to PythonAnywhere, but it doesn't configure the web app just yet. Not yet recommended for actual deployments yet.
This plugin is motivated by the desire to provide a deployment option for
django-simple-deploy that doesn't require a credit card to get started.
PythonAnywhere offers a free tier that allows users to deploy small Django apps
and may be a helpful way to get small Django apps online without financial
commitment.
Deployment to PythonAnywhere with this plugin requires a few prerequisites:
- You must use Git to track your project and push your code to a remote repository (e.g. GitHub, GitLab, Bitbucket).
- You must track dependencies with a
requirements.txtfile. - Create a PythonAnywhere Beginner account, which is a limited account with one web app, but requires no credit card.
- Generate an API token
- Ideally, stay logged in to PythonAnywhere in your default browser to make the first deployment smoother.
To set up a development environment for working on this plugin alongside
django-simple-deploy, follow these steps.
- Create a parent directory to hold your development work:
mkdir dsd-dev
cd dsd-dev/- Clone
dsd-pythonanywherefor development:
# Clone dsd-pythonanywhere for development (and switch to branch being worked on)
git clone git@github.com:caktus/dsd-pythonanywhere.git- Clone
django-simple-deployand create the blog sample project
git clone git@github.com:django-simple-deploy/django-simple-deploy.git
cd django-simple-deploy/
# Builds a copy of the sample project in parent dir for testing (../dsd-dev-project-[random_string]/)
uv run python tests/e2e_tests/utils/build_dev_env.py- Setup the development environment:
cd ../
cd dsd-dev-project-[random_string]/
source .venv/bin/activate
# Install dsd-pythonanywhere plugin in editable mode
pip install -e "../dsd-pythonanywhere/[dev]"-
Create a new public repository on GitHub.
-
Push the sample project to your new repository:
git remote add origin git@github.com:[your_github_username]/[your_new_repo_name].git
git branch -M main
git push -u origin main- Configure environment variables for PythonAnywhere API access:
export API_USER=[your_pythonanywhere_username]
export API_TOKEN=[your_pythonanywhere_api_token]- You can now make changes to
dsd-pythonanywherein the cloned directory and test them by running deployments from the sample project:
python manage.py deploy