Django-modpython project in a directory

Posted by Ankit Jaiswal on Stack Overflow See other posts from Stack Overflow or by Ankit Jaiswal
Published on 2010-06-17T09:15:46Z Indexed on 2010/06/17 9:33 UTC
Read the original article Hit count: 444

Filed under:
|
|

Hi All,

I am deploying a Django project on apache server with mod_python in linux. I have created a directory structure like: /var/www/html/django/demoInstall where demoInstall is my project. In the httpd.conf I have put the following code.

<Location "/django/demoInstall">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE demoInstall.settings
    PythonOption django.root django/demoInstall
    PythonDebug On
    PythonPath "['/var/www/html/django'] + sys.path"

</Location>

It is getting me the django environment but the issue is that the urls mentioned in urls.py are not working correctly.

In my url file I have mentioned the url like:

 (r'^$', views.index),

Now, in the browser I am putting the url like : http://domainname/django/demoInstall/ and I am expecting the views.index to be invoked. But I guess it is expecting the url to be only: http://domainname/ .

When I change the url mapping to:

  (r'^django/demoInstall$', views.index),

it works fine. Please suggest as I do not want to change all the mappings in url config file.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about python

Related posts about django