And we go from development to something accessible to the outside world! I'm more of a coder than a server configurer (sp???) and while I latched on to Django way back for the REST API framework primarily, I always have difficulty transitioning from development to production. This time I documented some issues I had so future me can hopefully learn something from past me.

MOD_WSGI and Apache

While overtime I've become a bit more comfortable playing with Apache, I've never been fully convinced that I am handling the WSGI configuration properly. With my upgrade from Django 1.11 to Django 3.0.8, a list of issues quickly cropped up.

  1. WSGI was not working properly. mod_wsgi needs to be compiled for the proper version of Python, and Djangos shift meant I had to remove the old one (apt-get remove libapache2-mod-wsgi) and install the new one (apt-get libapache2-mod-wsgi-py3). That took more time to discover than I'd like to admit
  2. WSGI and VirtualEnv always felt overly complicated to me. It seems my intuition was correct and after much searching I stumped upon this beautiful post that more or less says, most examples are out dated and you can probably just configure things in the Apache config file. This felt much cleaner, and I'm very glad to have found it so clearly stated.

CodeRedCMS/Wagtail and Django in general

The site is running on Codered CMS as I never quite liked pure Wagtail. I don't usually like software that hasn't even reached version 1.0 yet, but I've been happy with it so far. That said I started the project without first configuring things properly, and all my work was saved on a sqlite3 database. Migrating this to a MySQL database was necessary (for now, changing things to PostgreSQL is a future pain).

  1. The migration wasn't hard, but it did have a few steps. I found and followed this exactly and it was no issue in the end. Just make sure to create the database like it says in step 2!
  2. I then repeatedly found errors referring to being unable to create a cache folder, and when I made one manually, not having permissions to use it properly. This in the end was covered quite well in the Django docs here. I changed the folder to the temp folder as suggested (using File Cache), and it bingo, we're live
  3. I had to do a lot of error checking, so make sure your error log is set up properly. Barely matters where it is, but you'll save a lot of time in the long run.

Future plans will involve changing ALL this to use ASGI and Daphne, but it's very unnecessary at this point.