Deploy Wagtail CMS to PythonAnywhere

This is a tutorial about one way to build and deploy a Wagtail CMS site to PythonAnywhere.

It's a starting point that has most of the elements one might need (backend and frontend) to build a Wagtail site and deploy it live. It's by no means a complete site, in fact I've intentionally left out a lot of the things that make a site unique, such as the design, content, and custom code so that you can use this as a starting point for your own site.

I recommend you read:

The official Wagtail documentation and Developer Documentation, specifically Your first wagtail site

I wanted to document the process I go through. I've actually built and deployed a fair few Wagtail sites over the last decade using various hosting platforms, as a freelancer. I now work for Torchbox as a developer.

  • ✅ Python:3.10
  • ✅ Mysql Database
  • ✅ Node / webpack to build the frontend
  • ✅ CI actions for code checks
  • ✅ Pre-commit to run git hooks
  • ✅ Wagtail CMS v5.1.1
  • ✅ Django 4.2

The code here is the complete source code after following the tutorial.

Part 2 - Has optional steps to add front end code, code quality checks and CI checks.

Because I'm using git push to deploy the webapp and that requires SSH access, I am using a paid account on PythonAnywhere, which starts at €5/month.