Skip to content

caktus/dsd-pythonanywhere

Repository files navigation

dsd-pythonanywhere

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.

Motivation

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.

Quickstart

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.txt file.
  • 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.

Plugin Development

To set up a development environment for working on this plugin alongside django-simple-deploy, follow these steps.

  1. Create a parent directory to hold your development work:
mkdir dsd-dev
cd dsd-dev/
  1. Clone dsd-pythonanywhere for development:
# Clone dsd-pythonanywhere for development (and switch to branch being worked on)
git clone git@github.com:caktus/dsd-pythonanywhere.git
  1. Clone django-simple-deploy and 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
  1. 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]"
  1. Create a new public repository on GitHub.

  2. 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
  1. Configure environment variables for PythonAnywhere API access:
export API_USER=[your_pythonanywhere_username]
export API_TOKEN=[your_pythonanywhere_api_token]
  1. You can now make changes to dsd-pythonanywhere in the cloned directory and test them by running deployments from the sample project:
python manage.py deploy

About

A plugin for deploying Django projects to PythonAnywhere, using django-simple-deploy.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published