views:

52

answers:

2

My Django project is placed in /www/host1/htdocs/my/project, www and my are links to other actual folders. Apache has mod_python enabled. I have a .htaccess in project folder:

SetHandler python-program 
PythonHandler django.core.handlers.modpython 
SetEnv DJANGO_SETTINGS_MODULE project.settings 
PythonDebug On 
PythonOption django.root /my/project 
PythonPath "['/www/host1/htdocs/my/project'] + sys.path"

I suppose my site should be accessible from http://host1/my/project, but I see the following error:

ImportError: Could not import settings 'project.settings' (Is it on sys.path? Does it have syntax errors?): No module named project.settings

Can somebody give any suggestions?

A: 

My Conf file has the following lines:

SetHandler python-program
PythonPath "['c:/projectparentdir']+sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE project.settings
PythonOption django.root /project
PythonDebug On

The only difference I can see is that my python path points to the projects parent directory.

After using Django for a while with mod_python I am very keen to try out mod_wsgi, apparently a much more robust method.

danspants
+2  A: 

Use:

PythonPath "['/www/host1/htdocs/my', '/www/host1/htdocs/my/project'] + sys.path"

Ie.. parent and project folder.

Also ensure Apache user has rights to read stuff in your directories and write where appropriate.

Graham Dumpleton