Trying to get Django server running with Apache and WSGI
This is my wsgi.py
import os from django.core.wsgi import get_wsgi_application sys.path.append('/home/rohan/Desktop/narsil/narsil') # adjust the Python version in the line below as needed sys.path.append('/home/rohan/Desktop/narsil/narsilenv/lib/python3.6') os.environ.setdefault("DJANGO_SETTINGS_MODULE", "narsil.settings") application = get_wsgi_application()
And this is my /etc/apache2/sites-enabled conf file
<VirtualHost *:80> ServerName narsil.mti.local DocumentRoot /home/rohan/Desktop/narsil WSGIScriptAlias / /home/rohan/Desktop/narsil/narsil/wsgi.py # adjust the following line to match your Python path WSGIDaemonProcess narsil.mti.local processes=2 threads=15 display-name=%{GROUP} python-home=/home/rohan/Desktop/narsil/narsilenv/lib/python3.6/site-packages WSGIProcessGroup narsil.mti.local <directory /home/rohan/Desktop/narsil> AllowOverride all Require all granted Options FollowSymlinks </directory> Alias /static/ /home/rohan/Desktop/narsil/static/ <Directory /home/rohan/Desktop/rohan/static> Require all granted </Directory> </VirtualHost>
This is from the error log
Current thread 0x00007f0d45637bc0 (most recent call first): Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings'
I tried the similar solutions mentioned here but they dont seem to work. I am using virtualenv with pip install mod_wsgi. The Django is returning 404 Not Found This is the log from apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: *:80 is a NameVirtualHost default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1) port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1) port 80 namevhost narsil.mti.local (/etc/apache2/sites-enabled/narsil.conf:1) ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www/html" Main ErrorLog: "/var/log/apache2/error.log" Mutex default: dir="/var/run/apache2/" mechanism=default Mutex watchdog-callback: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG User: name="www-data" id=33 Group: name="www-data" id=33