开发者

Django and mod_python config

My Djan开发者_运维知识库go 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜