How to Deploy Wagtail To AWS EC2 and Digital Ocean

Share post:

Wagtail is a powerful and highly extensible open-source CMS based on Django web framework.

In this tutorial you will read how to prepare your project for production deployment and how to get your site deployed on AWS EC2 and Digital Ocean.

If you are looking for other deployment tutorials checkout out one of these:

In this post:

In order to create a blog project let's run these commands in terminal.

They will create a directory, python virtual environment and spin up a wagtail project from the template in the current directory.

mkdir myblog
cd myblog
python3 -m venv env
source env/bin/activate
pip install wagtail
wagtail start myblog .

Before we continue with installing dependencies open the requirements.txt in your code editor and add 2 new lines: whitenoise and django-environ.

Your requirements.txt would look like this:


Then run this to install all dependencies:

pip install -r requirements.txt

Now open the file myblog/settings/

Find the MIDDLEWARE and let's add whitenoise middleware right after SecurityMiddlware.

    "whitenoise.middleware.WhiteNoiseMiddleware", # new

Also add WHITENOISE_USE_FINDERS=True line to the same file, you can add it to the end of the file.

Now open the myblog/settings/ and add these lines to make sure our project respects environment variables when deployed in production.

We need to make sure that ALLOWED_HOSTS, SECRET_KEY and DATABASES are set correctly according to environment variables, because you never should hardcode any of those values and place them in version control.

Your myblog/settings/ should now look like this:

import environ
import os
from .base import *

DEBUG = False

    from .local import *
except ImportError:

env = environ.Env(
    # set casting, default value
    DEBUG=(bool, False)


ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=['*'])

    'default': env.db(),

In the root of our project, next to requirements.txt create a file called Procfile with the following content:

web: gunicorn myblog.wsgi:application --log-file -

Also create .gitignore file, which is useful to avoid cluttering our git repository with files that shouldn't be committed to version control.


Now initialize the repository, add and commit the code.

git init
git add .
git commit -m'Initial commit'

Create a GitHub or GitLab repository, add the remote and let's deploy it with Appliku.

Deploy Wagtail on AWS EC2

In order to deploy Wagtail project on AWS EC2 you need to generate AWS keys first. Follow instructions in this guide

After you have keys setup open Appliku dashboard and go to the "Servers" tab.

Select AWS provider.


Select the region, instance type and the disk size. To fit in AWS Free Tier make sure the disk size to be <30GB.



Click "Create EC2 Instance".

You will be taken to the server page where you will see the setup process. When it is finished, go to Applications tab and create a new app from GitHub (or GitLab if you hosted your repository there).

Deploy Wagtail on Digital Ocean

If you choose to go with Digital Ocean first make sure to create a DO account.

You will need to generate a token here

Make sure to select scopes both "Read" and "Write". We recommend to setup expiration to "Never" or "1 Year" to avoid service interruptions.


In Appliku dashboard go to Servers tab and click "Setup Credentials" for Digital Ocean. Paste and save the token and go back to Servers tab. You will be able to select Digital Ocean provider now.


Select the region and Droplet Type. For Droplet Size we strongly recommend to pick at least 1GB RAM instance so your server can build and run your app and the database.

Click "Create Droplet". image

Appliku will call Digital Ocean API and create a server for you and begin setup.

When that is finished you will be able to create the app and the database.

Deploy Wagtail with Appliku

Click on the "Applications" menu link.


If you haven't setup connection to will need to do that by clicking Setup Credentials.

When you are done you will be able to select the service you prefer. For this tutorial we'll go with GitHub


Give your app a name, select repository, branch and the server you have just created and click "Create Application".


Click on "Manage" in the databases block and add a database "Postgres 15" on the server we have just created.




Wait for it to get to "Deployed" status.

Go back to the application overview and click "Settings"



Go to the "Environment variables" tab. You see that our database's connection string is already there. Click "+ Add" and add variables: - "ALLOWED_HOSTS" must consist of the app name and "" so in our example it will be "" - SECRET_KEY: any random long string. Must be kept secret - DJANGO_SETTINGS_MODULE must be set to myblog.settings.production

Now click "Save And Deploy" image

You can go back to the application overview page and see that deployment has started.


The first deployment might take a bit longer, because the dependencies take some time to install at first run. Next deployments will take less time if you haven't changed requirements.txt file.

Click on "View Application"



Congratulations! You have deployed your Wagtail app!

Stop wasting time manually
deploying your apps!

Try our application deployment tool that allows you to set up servers automatically, deploy apps from git, manage Postgres backups and cron tasks.

  • Use a server from any cloud provider
  • Setup is done automatically
  • Deploy Django, Flask, FastAPI, Node apps
  • Unlimited number of databases
  • Custom domains and HTTPS
  • Focus on apps, we take care of deployments

As developers ourselves, we hated wasting time writing configuration files for web servers, CI pipelines and managing apps via SSH – so we built the system that we always wanted.

Appliku takes care of everything you need to deploy, run and manage your apps, while you can still do customized configuration if you choose to.

Try it with a free plan and see for yourself.

Start Free
Simple 5-minute setup – No credit card required
Share post: