I’ve been trying to get mod_wsgi working on a Mac OS X server, and I’m having absolutely no luck. I’ve added the LoadModule statement to the httpd.conf, and I’ve got the following file included:
apache_django_wsgi.conf:
WSGIDaemonProcess django
WSGIProcessGroup django
Alias /plagtest/ "/Users/plagtest/myproject/"
<Directory "/Users/plagtest/myproject/">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
WSGIScriptAlias /plagtest "/Users/plagtest/myproject/apache/myproject.wsgi"
<Directory "/Users/plagtest/myproject/apache">
Allow from all
</Directory>
And here’s my WSGI file:
myproject.wsgi:
import os
import sys
paths = [ '/Users/plagtest/myproject',
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
'/Users/plagtest',
]
for path in paths:
if path not in sys.path:
sys.path.append(path)
sys.executable = '/usr/local/bin/python2.7'
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I can restart Apache just fine, but when I browse to localhost/plagtest/ it comes up file not found, and this is what I get in the error log:
File does not exist: /Library/WebServer/Documents/plagtest/
I’m not entirely familiar with Apache, and I’m sure that it’s probably something very simple, but I can’t for the life of me find a solution online. Any help in this matter would be greatly appreciated.
It looks like you have two Aliases for the same path. So hence you have a duplication. Remove:
Without the media alias’s the django manuals recommended HTTP conf is: