[python-chinese] Django with mod_python
Luo Ben
benluo在gmail.com
星期一 十一月 27 16:36:59 HKT 2006
名位达人:
我在 Debian/testing 上安装了Python 2.4 以及 mod_pyton 3.x. Django 是 svn 在
/home/foo/ 里。在 site-packages 里做了一个 ln -s /home/foo/django-src/django
django
我在 /home/benluo 里用
django-admin.py startproject web
然后在 apache2 的配置中有以下配置
<VirtualHost *>
ServerAdmin benluo在linux.org.cn
ServerName blog.benluo.org
<Location "/">
SetHandler mod_python
PythonPath "['home/benluo']+sys.path"
SetEnv DJANGO_SETTINGS_MODULE web.settings
PythonHandler django.core.handlers.modpython
PythonDebug On
</Location>
</VirtualHost>
但当进入 blog.benluo.org 时出错。
***************************************************
Mod_python error: "PythonHandler django.core.handlers.modpython"
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
result = object(req)
File "/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py",
line 177, in handler
return ModPythonHandler()(req)
File "/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py",
line 145, in __call__
self.load_middleware()
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py",
line 22, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 27, in __getattr__
self._import_settings()
File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 54, in _import_settings
self._target = Settings(settings_module)
File "/usr/lib/python2.4/site-packages/django/conf/__init__.py",
line 82, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE,
e)
EnvironmentError: Could not import settings 'web.settings' (Is it on
sys.path? Does it have syntax errors?): No module named web.settings
*************************************************************
请问是什么原因。
谢谢!
Ben Luo
关于邮件列表 python-chinese 的更多信息