comment 0

My Experience Getting Started with Wagtail CMS and Deploying to Heroku

I was looking at the design of one of our Government Ministry websites and came to learn that they were using Wagtail CMS. Wagtail is free and open source and written in Python and uses the Django framework. I agree with Wikipedia when they say it is developer focused. There isn’t the same ease as with something like WordPress. I couldn’t even find a repository of templates or a place in settings to upload or install a template. How did they come up with the name? From the website –

Wagtails are pretty little birds from the Motacilla family. From spring to autumn they gather on the lawns outside Torchbox’s offices, charming us and our visitors. We wanted a name which reflected our beautiful setting and which had a sense of light and delight. Plus birds make easy logos.

I chose to use Heroku because I used it before to deploy my Ruby on Rails. My advice is to test deployment early and intermittently. If you do a search you might find the below post from 2015 which is from the perspective of an OS X user. I later found an updated post from 2017. I followed this and made adjustments for Windows.

https://wagtail.io/blog/deploying-wagtail-heroku/
https://wagtail.io/blog/wagtail-heroku-2017/

My adjustments and notes are below

Download and install latest Python 3.6.2 – https://www.python.org/downloads/
There is an option to Disable path length limit. I ignored this because I didn’t know if I needed it and I thought to myself that I could enable it later if I needed it.

Command pyvenv project_title gave me the following error. pyvenv : The term ‘pyvenv’ is not recognized as the name of a cmdlet, function, script file, or operable program. Found out that I could achieve the same using this command python -m venv project_title. Also source is not a Windows command so I needed to run .\project_title\scripts\activate.bat

Download and install PostgreSQL https://www.postgresql.org/download/windows/ and add postgres to PATH. C:\Program Files\PostgreSQL\9.6\bin and C:\Program Files\PostgreSQL\9.6\lib. Pass username to createdb command else it will try to use the Windows username e.g. createdb -U db_username demoapp_db

Your database settings in base.py should look like and that will get you started locally

DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’,
‘NAME’: ‘demoapp_db’,
‘USER’: ‘app_user’,
‘PASSWORD’: ‘app_user_pass’,
‘HOST’: ‘localhost’,
‘PORT’: ”,
}
}

Download and install Heroku CLI. It has an option to install Git at the same time. https://devcenter.heroku.com/articles/getting-started-with-python. Configure your git email address else it will try to use some weird email address from the Windows powershell environment. git config –global user.email “your@email.address”

My push to Heroku failed the first time because I specified the wrong Python version in runtime.txt. /app/.heroku/python/bin/pip: No such file or directory. I used python –version command to verify the version (python-3.6.2) and luckily it was in the list of supported versions in Heroku https://devcenter.heroku.com/articles/python-runtimes. Remember to add and commit again before push. If you delete and recreate the Heroku app or rename it like I did then you will need to change remote with command heroku git:remote -a “heroku_app_name”.

By default pages only have a title. From the getting started guide you can add a body and work your way from there. http://docs.wagtail.io/en/v1.12/getting_started/index.html. Two questions I would like to ask persons experienced in Wagtail. Why use Wagtail? Who uses Wagtail? Share your thoughts and experiences with me in the comments below.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s