Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
"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
add comment

1 Answer

up vote 1 down vote accepted

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')), )
share|improve this answer
    
Thanks! It works with the second workaround! –  Cheluis Mar 22 '11 at 3:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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