Python论坛  - 讨论区

标题:[python-chinese] Django with mod_python

2006年11月27日 星期一 16:36

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 的配置中有以下配置


        ServerAdmin benluo在linux.org.cn
        ServerName blog.benluo.org
       
                  SetHandler mod_python
                  PythonPath "['home/benluo']+sys.path"
                  SetEnv DJANGO_SETTINGS_MODULE web.settings
                  PythonHandler django.core.handlers.modpython
                  PythonDebug On
      


但当进入 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

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

2006年11月27日 星期一 22:57

ZhengPeng Hou zhengpeng-hou在ubuntu.com
星期一 十一月 27 22:57:11 HKT 2006

On Mon, Nov 27, 2006 at 04:36:59PM +0800, Luo Ben wrote:
> 名位达人:
> 
> 我在 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 的配置中有以下配置
> 
> 
>         ServerAdmin benluo at linux.org.cn
>         ServerName blog.benluo.org
>        
>                   SetHandler mod_python
>                   PythonPath "['home/benluo']+sys.path"
>                   SetEnv DJANGO_SETTINGS_MODULE web.settings
>                   PythonHandler django.core.handlers.modpython
>                   PythonDebug On
>       
> 
> 
> 但当进入 blog.benluo.org 时出错。
您使用debian testing的话,能否帮忙测试django的包 :) 
> ***************************************************
> 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
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://python.cn/pipermail/python-chinese/attachments/20061127/46a7b539/attachment.pgp 

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

2006年11月28日 星期二 10:55

Luo Ben benluo在gmail.com
星期二 十一月 28 10:55:51 HKT 2006

找到解决办法了。
应该是 /home/benluo 不是 home/benluo
而且要 /home/benluo  chmod o+r
不过这样太危险。换了一个别的目录。

On 11/27/06, ZhengPeng Hou <zhengpeng-hou在ubuntu.com> wrote:
> On Mon, Nov 27, 2006 at 04:36:59PM +0800, Luo Ben wrote:
> > 名位达人:
> >
> > 我在 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 的配置中有以下配置
> >
> > 
> >         ServerAdmin benluo在linux.org.cn
> >         ServerName blog.benluo.org
> >        
> >                   SetHandler mod_python
> >                   PythonPath "['home/benluo']+sys.path"
> >                   SetEnv DJANGO_SETTINGS_MODULE web.settings
> >                   PythonHandler django.core.handlers.modpython
> >                   PythonDebug On
> >       
> > 
> >
> > 但当进入 blog.benluo.org 时出错。
> 您使用debian testing的话,能否帮忙测试django的包 :)
> > ***************************************************
> > 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
> > 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
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
>
> iD8DBQFFavzHJrhDLBNiZtwRAhhnAJ0SC8wlflIab3/y14mkTA3XbYbxaACfVOiT
> HsTTQLvToIqHw2TH56CJeY4=
> =W8uQ
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> 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号