Python论坛  - 讨论区

标题:[python-chinese] Django集成apache+mod_python

2007年07月13日 星期五 14:33

cafeeee cafeeee在gmail.com
星期五 七月 13 14:33:05 HKT 2007

想把Django集成到apache+mod_python中,总是有如下错误:

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
1128, in _execute_target
    result = object(arg)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
line 177, in handler
    return ModPythonHandler()(req)

  File "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
line 145, in __call__
    self.load_middleware()

  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py",
line 22, in load_middleware
    for middleware_path in settings.MIDDLEWARE_CLASSES:

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
line 28, in __getattr__
    self._import_settings()

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
line 55, in _import_settings
    self._target = Settings(settings_module)

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
line 83, 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 'kweb.settings' (Is it on
sys.path? Does it have syntax errors?): No module named kweb.settings


在 /etc/httpd/conf.d/python.conf 中我是这么配的:
....

    SetHandler python-program
    PythonPath "['/home/test'] + sys.path"
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE kweb.settings
    PythonDebug On

....


kweb 这个包是在 /home/test/ 下边的,而且我用 kweb/manager.py runserver 是可以正常运行起来的

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月13日 星期五 14:39

cun heise cunheise在hotmail.com
星期五 七月 13 14:39:17 HKT 2007

ÄãµÄdjangoµÄpermissionsÓÐÎÊÌ⣬ҪÓÐroot:root
ÄãÊDz»ÊÇÓÃsvn co µÄversion


>From: cafeeee <cafeeee在gmail.com>
>Reply-To: python-chinese在lists.python.cn
>To: python-chinese在lists.python.cn
>Subject: [python-chinese] Django¼¯³Éapache+mod_python
>Date: Fri, 13 Jul 2007 14:33:05 +0800
>
>想把Django集成到apache+mod_python中,总是有如下错误:
>
>Traceback (most recent call last):
>
>   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
>1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
>1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
>1128, in _execute_target
>     result = object(arg)
>
>   File 
"/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
>line 177, in handler
>     return ModPythonHandler()(req)
>
>   File 
"/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
>line 145, in __call__
>     self.load_middleware()
>
>   File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py",
>line 22, in load_middleware
>     for middleware_path in settings.MIDDLEWARE_CLASSES:
>
>   File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
>line 28, in __getattr__
>     self._import_settings()
>
>   File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
>line 55, in _import_settings
>     self._target = Settings(settings_module)
>
>   File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
>line 83, 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 'kweb.settings' (Is it on
>sys.path? Does it have syntax errors?): No module named kweb.settings
>
>
>åœ?/etc/httpd/conf.d/python.conf 中我是这么配的:
>....
>
>     SetHandler python-program
>     PythonPath "['/home/test'] + sys.path"
>     PythonHandler django.core.handlers.modpython
>     SetEnv DJANGO_SETTINGS_MODULE kweb.settings
>     PythonDebug On
>
>....
>
>
>kweb 这个包是åœ?/home/test/ 下边的,而且我用 kweb/manager.py 
runserver 是可以正常运行起来的
>_______________________________________________
>python-chinese
>Post: send python-chinese在lists.python.cn
>Subscribe: send subscribe to python-chinese-request在lists.python.cn
>Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese

_________________________________________________________________
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà  Live Messenger; 
http://get.live.com/messenger/overview 


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月13日 星期五 14:43

cafeeee cafeeee在gmail.com
星期五 七月 13 14:43:13 HKT 2007

¹ûÈ»ÊÇȨÏÞµÄÎÊÌ⣬ÎÒ°Ñkweb·ÅÔÚÁËhomeĿ¼Ï£¬apache¿ÉÄÜ·ÃÎʲ»µ½....

¶àл¶àл


On 7/13/07, cun heise <cunheise在hotmail.com> wrote:
> ÄãµÄdjangoµÄpermissionsÓÐÎÊÌ⣬ҪÓÐroot:root
> ÄãÊDz»ÊÇÓÃsvn co µÄversion
>
>
> >From: cafeeee <cafeeee在gmail.com>
> >Reply-To: python-chinese在lists.python.cn
> >To: python-chinese在lists.python.cn
> >Subject: [python-chinese] Django¼¯³Éapache+mod_python
> >Date: Fri, 13 Jul 2007 14:33:05 +0800
> >
> >想把Django集成到apache+mod_python中,总是有å¦b下错误:
> >
> >Traceback (most recent call last):
> >
> >   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> >1537, in HandlerDispatch
> >     default=default_handler, arg=req, silent=hlist.silent)
> >
> >   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> >1229, in _process_target
> >     result = _execute_target(config, req, object, arg)
> >
> >   File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line
> >1128, in _execute_target
> >     result = object(arg)
> >
> >   File
> "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
> >line 177, in handler
> >     return ModPythonHandler()(req)
> >
> >   File
> "/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py",
> >line 145, in __call__
> >     self.load_middleware()
> >
> >   File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py",
> >line 22, in load_middleware
> >     for middleware_path in settings.MIDDLEWARE_CLASSES:
> >
> >   File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
> >line 28, in __getattr__
> >     self._import_settings()
> >
> >   File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
> >line 55, in _import_settings
> >     self._target = Settings(settings_module)
> >
> >   File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
> >line 83, 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 'kweb.settings' (Is it on
> >sys.path? Does it have syntax errors?): No module named kweb.settings
> >
> >
> >åœ?/etc/httpd/conf.d/python.conf 中我是这么配的:
> >....
> >
> >     SetHandler python-program
> >     PythonPath "['/home/test'] + sys.path"
> >     PythonHandler django.core.handlers.modpython
> >     SetEnv DJANGO_SETTINGS_MODULE kweb.settings
> >     PythonDebug On
> >
> >....
> >
> >
> >kweb 这个包是åœ?/home/test/ 下边的,而且我用 kweb/manager.py
> runserver 是可以正常运行起来的
> >_______________________________________________
> >python-chinese
> >Post: send python-chinese在lists.python.cn
> >Subscribe: send subscribe to python-chinese-request在lists.python.cn
> >Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> >Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
> _________________________________________________________________
> ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà  Live Messenger;
> http://get.live.com/messenger/overview
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号