I’ve tried so much and feels i’m stuck and not getting anywhere Apache is giving an error which is
ModuleNotFoundError: No module named ‘wearpretty.settings’
I’m using
python 3.6,
Django2.1,
apache2,
libapache2-mod-wsgi-py3
Below are the files which are being used in this.
wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ["DJANGO_SETTINGS_MODULE"] = "wearpretty.settings"
application = get_wsgi_application()
virtualhost.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName lhwearpretty.com
ServerAlias www.lhwearpretty.com
DocumentRoot /var/www/myprojects/wearpretty/wearpretty/wearpretty
<Directory /var/www/myprojects/wearpretty/wearpretty/wearpretty>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess lhwearpretty.com python-home=/var/www/myprojects/wearpretty/venv python-path=/var/www/myprojects/wearpretty
WSGIProcessGroup lhwearpretty.com
WSGIScriptAlias / /var/www/myprojects/wearpretty/wearpretty/wearpretty/wsgi.py
Alias /static/ /var/www/myprojects/wearpretty/wearpretty/static/
<Directory /var/www/myprojects/wearpretty/wearpretty/static>
Require all granted
</Directory>
</VirtualHost>
2
Answers
As i started this myself i figured out there's some issue with naming of my directories. Anyone who's starting first time he should be aware you can't use your Site dir name as your Project name. so i changed it.
Old Structure
New Structure
Virtualhost.conf
Hopefully This'll help others as well.
Your DocumentRoot should be one folder up (minus 1
/wearpretty
) and python-path var in WSGIDaemonProcess should be one down (plus 1/wearpretty
) : they must point to you Django Project root.Also, I would recommend to add this Directory node :