[Answered ]-Mod_wsgi with Django 500 error

2πŸ‘

βœ…

It sound like your apache configuration is giving you most of the problems. Please try to write to a log file from within wsgi.py file and determine if the server atleast uses the correct wsgi file.

For what it is worth I am attaching contents of a_django_site.conf apache config file. this file should be in /etc/apache2/sites-available and should be enabled using sudo a2ensite a_django_site.conf thereafter reload and restart.

Define MY_IP=129.222.333.444
WSGIPythonPath  /home/your_name/.virtualenvs/venv_proj_name/bin/python:/home/your_name/.virtualenvs/venv_proj_name/lib/python2.7/site-packages


<VirtualHost *:80>
ServerAdmin root@localhost
ServerName {MY_IP}
ServerAlias http://{MY_IP}/

DocumentRoot /usr/local/src/proj_dir

Alias /static /usr/local/src/proj_dir/django_static/
Alias /images /usr/local/src/proj_dir/stock/media/
Alias /favicon.ico /usr/local/src/proj_dir/apache/favicon.png

WSGIScriptAlias / /usr/local/src/proj_dir/proj_name/wsgi.py

<Directory />
    Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
</VirtualHost>
πŸ‘€user3481141

Leave a comment