A checklist for moving a Django-Wagtail project to PythonAnywhere. There is documentation on the PythonAnywhere site; mine includes things I forget.
Setup: development and testing on my laptop, staging and production on PythonAnywhere.
The help files are pretty good, but I need my own checklist. Right now I’m in the staging mode, but at some stage I’ll be moving to production. No point figuring out the same things twice!
- Develop on laptop in a virtualenv. Push commits regularly to bitbucket account. At some stage squash the migrations and clean those up. Four sets of settings: dev, testing, staging, production.
- Set up account on PythonAnywhere that allows the use of Postgres (it’s an add-on to a custom plan).
- Create virtualenv and set up staging web app. Delete virtualenv when you realise you didn’t use the right version of Python and the default is 2.7, not 3.5. Recreate the virtualenv with python 3.5.
- Clone the repository (using the ssh-keygen instructions). Redirect the public key to a file so you can copy it without line-breaks getting in the way.
pip install -r requirements/production.txt(including psycopg2, which I didn’t need for development).
- Create the Postgres server, user, and database Don’t forget a strong password for the user (owner of the project database).
- Update the settings file with the database settings.
- Set the environment variables for the settings and the secret key (generator).
- Attempt to apply the migrations. This will show where you made mistakes on all the preceding steps.
- Fix the mistakes. Reload the web app to see if anything shows up.
- Set up the static file server. Check the static files are being served correctly.
- Create the Django superuser and log in.
The next step is data, of course.