Python Forum
Trouble deploying Django/wagtail on Ubuntu 14.04
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble deploying Django/wagtail on Ubuntu 14.04
#1
I successfully installed wagtail’s bakery demo site locally. I ended up leveraging the README for this bakery demo site on their GitHub page which calls to use a ‘virtualenvwrapper’ instead of a typical venv. As instructed I played around with some configuration files. I got it working. Here is a .webm video showcasing my site running locally.

But when I attempt to deploy it on my DigitalOcean Droplet, Apache is throwing all sorts of errors. The problem is with my configuration. I am not sure what I have to change to make it right.

Here is my site showing an Apache Internal Server Error: https://daniel496.agency/

Here is a pastebin showing the most recent lines of traceback from my Apache log file. That log file is pointing me in a few directions. I ensure that my Apache sites-available file points to wsgi.py inside the bakerydemo project folder. I tried both wsgi.py and production_wsgi.py.

Here are the contents of my ssl Apache sites-available ssl config:
Quote:<IfModule mod_ssl.c>
<VirtualHost *:443>


ServerAdmin <user>@gmail.com
ServerName daniel496.agency
ServerAlias www.daniel496.agency
# DocumentRoot /var/www/html/daniel496.agency/public_html

# ErrorLog ${APACHE_LOG_DIR}/error.log
ErrorLog ${APACHE_LOG_DIR}/daniel496/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# Original Django project commented out 19 March 2018 to make room for Django project below
<IfDefine IgnoreBlockComment>
Alias /static /home/<user>/TheGreatWork/static
<Directory /home/<user>/TheGreatWork/static>
Require all granted
</Directory>

<Directory /home/<user>/TheGreatWork/TheGreatWork>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

WSGIDaemonProcess TheGreatWork python-home=/home/<user>/TheGreatWork/venv
WSGIProcessGroup TheGreatWork
WSGIScriptAlias / /home/<user>/TheGreatWork/TheGreatWork/wsgi.py

</IfDefine>


# 2nd Django project (wagtail demo)
Alias /static /home/<user>/bakerydemo/bakerydemo/static
<Directory /home/<user>/bakerydemo/bakerydemo/static>
Require all granted
</Directory>

<Directory /home/<user>/bakerydemo/bakerydemo>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

WSGIDaemonProcess bakerydemo python-home=/home/<user>/.virtualenvs/wagtailbakerydemo/
WSGIProcessGroup bakerydemo
WSGIScriptAlias / /home/<user>/bakerydemo/bakerydemo/wsgi.py

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/daniel496.agency/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/daniel496.agency/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/daniel496.agency/chain.pem

</VirtualHost>
</IfModule>

Take note the project called, TheGreatWork. That is a previous project I've temporarily set aside. I invoked a multi-line block comment in this Apache starting with <IfDefine IgnoreBlockComment> and ending with </IfDefine>

As part of setting up virtualenvwrapper, I’ve assigned my virtual environments to: /home/<user>/.virtualenvs, which appears to be an issue in the error log as well, so maybe this could be the problem with my setup?

I’ve ruled out the possibility that the issue has something to do with the Python version 2.7-based libapache2-mod-wsgi because I purged my system of that library. All that exists now is libapache2-mod-wsgi-py3.

I'm running Ubuntu 14.04 on my Droplet, running Python 3.4 and Django 2.0.

Is there any other information I could provide?

Thanks for your attention.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  deploying python script on a server rickyrt 0 1,439 Aug-31-2021, 04:03 PM
Last Post: rickyrt
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,245 Jun-30-2019, 12:21 AM
Last Post: scidam
  Trouble deploying Django (project folder, wsgi.py and libapache2-mod-wsgi) Drone4four 8 7,881 Mar-17-2018, 09:40 PM
Last Post: Drone4four
  Deploying SSL for my Django 2.0.1 server with Apache on Ubuntu 16.04 (droplet) Drone4four 2 9,030 Jan-26-2018, 06:44 AM
Last Post: Drone4four

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020