django - ImportError:没有名为modpython的模块

时间:2012-07-13 08:37:52

标签: django apache2 mod-python

我正在尝试在我的虚拟主机上设置django并且遇到了这个错误:

MOD_PYTHON ERROR

ProcessId:      4496
Interpreter:    'ouiop'

ServerName:     'ouiop.com'
DocumentRoot:   '/var/www/vhosts/ouiop.com/httpdocs'

URI:            '/'
Location:       '/'
Directory:      None
Filename:       '/var/www/vhosts/ouiop.com/httpdocs/'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'django.core.handlers.modpython'

Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1202, in _process_target
    module = import_module(module_name, path=path)

  File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 304, in import_module
    return __import__(module_name, {}, {}, ['*'])

ImportError: No module named modpython

我在网上做了一些研究,看看是否有人有同样的问题,但没有运气解决它:/

这也是我的vhosts.conf

<Location "/">
SetHandler python-program
PythonPath "['/var/www/vhosts/ouiop.com/httpdocs/django_projects'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE ouiop.settings
PythonDebug On
PythonInterpreter ouiop
</Location>

<Location "/media">
SetHandler None
</Location>

<LocationMatch "\.(jpg|gif|png)$">
SetHandler None
</LocationMatch>

感谢任何帮助

由于

2 个答案:

答案 0 :(得分:6)

你可能正在使用已停止支持mod_python的Django 1.5

并切换到wsgi,请参阅http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10.04-lucid

答案 1 :(得分:0)

你需要mod_python lib for apache

http://www.modpython.org/

不推荐使用btw ..您应该使用mod_wsgi