user1680859
user1680859

Reputation: 1194

Requested URL not found with mod_wsgi in Django

I am trying to get django to work on apache with mod_wsgi. My djang.wsgi code is:

import os, sys
sys.path.append('C:/djcode/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

And my configuration in 'httpd' is:

Alias /static/ "C:/djcode/mysite/static/"
<Directory C:/djcode/mysite/static/>
Order deny,allow
Allow from all
</Directory>

WSGIScriptAlias / C:/djcode/mysite/apache/django.wsgi

<Directory C:/djcode/mysite/apache>
Order deny,allow
Allow from all
</Directory>

Alias /files/ "C:/djcode/mysite/files/"
<Directory C:/djcode/mysite/files/>
Order deny,allow
Allow from all
</Directory>

In the folder 'files' are files where I read data (not databases) which are used to output in templates.

The urls.py code is as follows:

urlpatterns = patterns('',
    ('^all/$', all),
    ('^(sport)/$', gen),
    ('^(teknology)/$', gen),
    ...

When I start Apache, localhost, the message is "It works!". But when I try localhost/all' or localhost/mysite or localhost/mysite/all, the browser says "The requested URL /all was not found on this server`. I can not understand where does it fail

Upvotes: 2

Views: 3561

Answers (2)

apurva.nandan
apurva.nandan

Reputation: 1101

Please make sure, you have the VirtualHost configuration correctly setup in the httpd.conf file. Try using localhost first (as the ServerName) and see if it works.

Upvotes: 0

virtuexru
virtuexru

Reputation: 888

Where is the definition or class for all? It's technically the controller. Can you post it?

This line routes it:

('^all/$', all)

But we don't know what all is.

Upvotes: 2

Related Questions