1

I'm trying to set up an apache + mod_wsgi environment for a Django site on Linux Mint. I followed the django site tutorial for this, and mod_wsgi site too. So far I got this:

on my httpd.conf I have this:

WSGIScriptAlias /site /path/to/wsgi_scripts/django.wsgi

<Directory /path/to/wsgi_scripts>
Order deny,allow
Allow from all
</Directory>

in site.urls I have this:

urlpatterns = patterns('',
    (r'^site/', include('app.urls')),
)

So, if I try to access the url localhost/site/index, it shows django view for a non-exists url, but, if I access localhost/site/site/index, it works fine.

My question is, which is the way to rid off the first "site" and that the application uses the urls from the alias that I'm using in the httpd.conf. Also, it works if I use the alias in the httpd.conf like this

WSGIScriptAlias / /path/to/wsgi_scripts/django.wsgi

but I don't want to use it in this way. Suggestions?

Thanks in advance

  • "So, if I try to access the url localhost/site/index, it shows django view for a non-exists url, but, if I access localhost/site/site/index, it works fines." sounds like you need to change r'^site/' to r'^site' (remove the trailing slash) – SLY Mar 22 '11 at 1:30
1

The WSGIScriptAlias to /site is effectively making http://localhost/site/ the root for your Django app. Either set your configuration in httpd.conf to be:

WSGIScriptAlias / /path/to/wsgi_scripts/django.wsgi

or your urls.py in your Django app to be

urlpatterns = patterns('', (r'', include('app.urls')), )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.