【问题标题】:Django, mod_python, apache deployment: mod_python import errorDjango、mod_python、apache 部署:mod_python 导入错误
【发布时间】:2012-08-17 15:44:36
【问题描述】:

我已经安装了 mod_python,但是当我尝试使用它时:

例如。

>>>import mod_python
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  ImportError: No module named mod_python

-

[root@lab6 /]# yum install mod_python
Loaded plugins: rhnplugin, security
Setting up Install Process
Package mod_python-3.2.8-3.1.x86_64 already installed and latest version
Nothing to do

即使我已经导入也无法导入 将其安装在 Redhat 服务器中。

它应该被用来通过这个 httpd.conf 条目在 Redhat 服务器中部署 Django:

<VirtualHost mritest2.domain.ch:80>
        ServerName mritest2.domain.ch
        DocumentRoot /home/django_www/hardi

        <Location "/">
            SetHandler python-program
            PythonHandler django.core.handlers.modpython
            SetEnv DJANGO_SETTINGS_MODULE mri.settings
            PythonDebug On

            PythonPath "['/home/django_www', '/home/django_www/hardi'] + sys.path"
        </Location>

        <Location "/static/">
            SetHandler None
        </Location>
</VirtualHost>

【问题讨论】:

    标签: django apache mod-python


    【解决方案1】:

    mod_python 是一个 HTTPd 模块,而不是 Python 包;它的虚拟模块只能用于它正在运行的代码,而不是 REPL。

    但事实上 mod_python 一直是dead for a while now,你应该尽快迁移到 mod_wsgi。

    【讨论】:

    • 谢谢,我有另一个关于 mod_wsgi 的问题:我正在尝试安装它 - "sudo ./configure --with-python=/opt/python2.5/bin/python" 但我在我的文件系统中找不到这个目录:“/opt/python2.5/bin/python”。还有其他方法可以安装 mod_wsgi 吗?
    • 刚试了一下,还是不行:“没有可用的包mod_wsgi。”
    • 问题已解决:我在“/root/epd-5.1.0/bin/python”找到了目录,谢谢!
    猜你喜欢
    • 1970-01-01
    • 2010-10-04
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 2010-11-01
    • 2010-10-23
    • 1970-01-01
    相关资源
    最近更新 更多