Configure Django project in a subdirectory using mod_python. Admin not working.

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2009-08-26T23:19:57Z Indexed on 2010/05/14 17:04 UTC
Read the original article Hit count: 157

Filed under:
|
|
|
|

HI guys. I was trying to configure my django project in a subdirectory of the root, but didn't get things working.(LOcally it works perfect). I followed the django official django documentarion to deploy a project with mod_python. The real problem is that I am getting "Page not found" errors, whenever I try to go to the admin or any view of my apps.

Here is my python.conf file located in /etc/httpd/conf.d/ in Fedora 7

LoadModule python_module modules/mod_python.so

SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['/var/www/vhosts/mysite.com/httpdocs','/var/www/vhosts/mysite.com/httpdocs/mysite'] + sys.path"

I know /var/www/ is not the best place to put my django project, but I just want to send a demo of my work in progress to my customer, later I will change the location.

For example. If I go to www.domain.com/mysite/ I get the index view I configured in mysite.urls. But I cannot access to my app.urls (www.domain.com/mysite/app/) and any of the admin.urls.(www.domain.com/mysite/admin/)

Here is mysite.urls:

urlpatterns = patterns('',

url(r'^admin/password_reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'),
(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'),
(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),
(r'^$', 'app.views.index'),
(r'^admin/', include(admin.site.urls)),
(r'^app/', include('mysite.app.urls')),
(r'^photologue/', include('photologue.urls')),

)

I also tried changing admin.site.urls with ''django.contrib.admin.urls' , but it didn't worked. I googled a lot to solve this problem and read how other developers configure their django project, but didn't find too much information to deploy django in a subdirectory. I have the admin enabled in INSTALLED_APPS and the settings.py is ok.

Please if you have any guide or telling me what I am doing wrong it will be much appreciated.

THanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about django