<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>
WSGIDaemonProcess bakerydemo python-home=/home/<user>/.virtualenvs/wagtailbakerydemo/ python-path=/home/<user>/bakerydemo/
No module named 'bakerydemo'" because you did not add the project directory to the python-path. Hope this works.
In the logs you see "
Best regards
Andreas
Thank you for your reply, Tom.
Here it is running as intended: https://daniel496.agency/
Inside the TEMPLATES variable, the line for ‘DIRS’ now a list which now reads: [PROJECT_ROOT + '/bakerydemo/templates']
'DIRS': [PROJECT_ROOT + '/bakerydemo/templates'],
M project root directory is /home/tranq/bakerydemo and the addition symbol binds the subsequent string together to create a new string as it is read by the interpreter: '/home/<user>/bakerydemo/bakerydemo/templates'
I also had to toy around a bit with group and ownership permissions. Here are the winning commands I used in the end:
$ chmod 775 /home/tranq/bakerydemo
$ chown :www-data /home/tranq/bakerydemo
$ chmod 775 /home/tranq/bakerydemo/bakerydemodb
$ chown :www-data /home/tranq/bakerydemo/bakerydemodb
$ chown -R :www-data /home/tranq/bakerydemo/bakerydemo/media
I had this demo running perfectly weeks ago. I meant to report back here like this sooner. Sorry. Better late than never?