I have a Linux server (Ubuntu) and am trying to set up apache, but the server is not running my actual Django server but instead running an html file in var/www/html. Running
sudo systemctl reload apache2
works fine, so I think the problem involves the .conf file in /etc/apache2/sites-available/ called infosum.conf somehow.
This is for a new Linux server (Ubuntu). The project is running python3 Django 2.2 and apache 2.4 with mod-wsgi. When running
python manage.py runserver 0.0.0.0:8000
, the server works fine, but when on the apache server it just returns that HTML file.
/etc/apache2/sites-available/infosum.conf (infosum is project name)
Alias /static/ /home/username/infosum/staticfiles
<Directory /home/username/infosum/staticfiles>
Require all granted
</Directory>
Alias /media/ /home/username/infosum/media/
<Directory /home/username/infosum/media>
Require all granted
</Directory>
<Directory /home/username/infosum/infosum>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/username/infosum/infosum/wsgi.py
WSGIDaemonProcess django_app python-path=/home/username/infosum python-home=/home/username/infosum/venv
WSGIProcessGroup django_app
/home/username/infosum/infosum/wsgi.py
import os
import sys
sys.path.append('/home/username/infosum/infosum')
# add the virtualenv site-packages path to the sys.path
sys.path.append('/home/username/infosum/venv/Lib/site-packages')
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'infosum.settings')
application = get_wsgi_application()
UPDATE: I just ran
sudo a2ensite infosum
and it worked in, I think, getting the site up. One problem, there is a 500 server error and when running
sudo tail -f /var/log/apache2/error.log
I get
ImportError: No module named django.core.wsgi