开发者

Works using Django development server, but throws import error with Apache using mod_wsgi

I have a Django project that works fine with the development server that comes with it.

No errors are produced at all when I use "django manage.py runserver" and the app works fine, but when I try to use it with mod_wsgi and Apache the browser displays "Internal Server Error" with a 500 error code and it generates an import error in the Apache error log.

Here's the error in the log:

ImportError: No module named registration

I'm using the Django registration module which is located in a path like this:

/opt/raj/photos/registration

I know that the registration app is in the path because I can fire up a Python shell, import sys, and get a list of paths using sys.path.

Here are some of the paths output from Python shell:

sys.path ['', '/opt/raj/pyamf', '/opt/raj', '/opt/raj/pictures', '/opt/raj/pictures /registration', '/usr/lib/python2.6',....]

Any thoughts would b开发者_如何学Goe appreciated.


Is it in the pythonpath for the webserver? All those '/opt' paths are typically not in the standard python path, so something is adding those for you I would guess. Are you sure it also gets added for the webserver process, or is PYTHONPATH set in some shell configfile somewhere for your user only?

There is a PythonPath directive when using mod_python, is there something similar for mod_wsgi?

This is almost certainly a case of the path not being the same for the webserver as it is for you, so I would focus my search in those areas.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜