Trying to serve a django admin site to no avail. A 500 internal server error occurs when requested. The error claims the wsgi.py cannot be loaded as Python module. Below see the internal server error and the relevant files.
Possibly related: At first was trying with a local build of python. Another system admin tried this loca build of python and it would not execute. This local build is only working for my user. I say this is possibly related but have tried with the system python too.
500 internal server error when the site is requested. Here is the server error log:
[error] [client 208.120.168.168] mod_wsgi (pid=20239): Target WSGI script '/home/andrew/public_html/7DigAdmin/wsgi.py' cannot be loaded as Python module.
[error] [client 208.120.168.168] mod_wsgi (pid=20239): Exception occurred processing WSGI script '/home/andrew/public_html/7DigAdmin/wsgi.py'.
[error] Traceback (most recent call last):
[error] File "/home/andrew/public_html/7DigAdmin/wsgi.py", line 5, in ?
[error] import os
[error] ImportError: No module named os
wsgi.py:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "/home/andrew/SCTN_7DigAdmin/SCTN_7DigAdmin/SCTN_7DigAdmin.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
wsgi.conf:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /usr/local/bin/python2.7
httpd.conf:
WSGIScriptAlias /7dadmin /home/andrew/public_html/7DigAdmin/wsgi.py
<Directory /home/andrew/public_html/7DigAdmin>
Order allow,deny
Allow from all
</Directory>
I imagine the error is because you are setting WSGIPythonHome
to the Python bin directory. As the mod_wsgi documentation explains, it's supposed to be pointing to the library directory. Your error is because the normal library files, such as the os
module, are not in that bin directory.
However, that directive should only be used where the library files are in an unexpected location, which doesn't seem to be the case for you. You should remove that directive completely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With