Pregunta

I've already installed mod_python, but when i'm trying to use it:

eg.

>>>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

I can't import it even though i've already installed it in a Redhat server.

And it's suposed to be used to deploy Django in a Redhat server with this httpd.conf entry:

<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>
¿Fue útil?

Solución

mod_python is a HTTPd module, not a Python package; its virtual modules are only available to code it is running, not the REPL.

But in truth mod_python has been dead for a while now, and you should migrate to mod_wsgi ASAP.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top