我已经安装了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>
答案 0 :(得分:4)
mod_python是一个HTTPd模块,而不是Python包;它的虚拟模块仅适用于正在运行的代码,而不是REPL。
但实际上mod_python已经dead for a while now,你应该尽快迁移到mod_wsgi。