When I run my application using the built-in Djangos server, everything works fine. But when I try to run through Apache and WSGI, the URL is no longer recognized, but it is in the urls.py file.
The error page I am getting is this:
Page not found (404) Request Method: GET Request URL: http://localhost/project/app/live/ Using the URLconf defined in project.urls, Django tried these URL patterns, in this order: ^media/(?P<path>.*)$ ^app/live/ The current URL, app/live/, didn't match any of these. You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
As you can see, the URL (app / live /) is directly in the URL patterns from the top-level urls.py file. There are also no errors in the Apache errors.log file.
My urls.py:
from django.conf.urls.defaults import * from django.conf import settings urlpatterns = patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT }), (r'^app/live/', include('project.app.urls', app_name='live')), )
My WSGI file:
import os import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../..') os.environ["DJANGO_SETTINGS_MODULE"] = "project.settings" import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
And finally, my Apache configuration:
WSGIDaemonProcess project processes=2 maximum-requests=500 threads=1 WSGIProcessGroup project WSGIScriptReloading On WSGIScriptAlias /project /home/user/project/apache/project.wsgi
EDIT:
After entering some debug output in RegexURLResolver, I saw that it was trying to resolve both app/live/ and project/app/live/ .
So, I changed the urls.py file to this:
from django.conf.urls.defaults import * from django.conf import settings urlpatterns = patterns('', (r'^app/live/', include('project.app.urls', app_name='live')), (r'^project/app/live/', include('project.app.urls', app_name='live')), )
It works now.