1

私はすでに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>
4

1 に答える 1

4

mod_pythonはHTTPdモジュールであり、Pythonパッケージではありません。その仮想モジュールは、REPLではなく、実行中のコードでのみ使用できます。

しかし、実際にはmod_pythonはしばらくの間死んでいるので、できるだけ早くmod_wsgiに移行する必要があります。

于 2012-08-22T08:48:46.433 に答える