I'm trying to setup django on my vhost and got stuck on this error:

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

I did some research online to see if anyone had the same problem, but had no luck to solve it :/

Also here is my 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>

Any help is appreciated

Thanks

有帮助吗?

解决方案

You need the mod_python lib for apache

http://www.modpython.org/

Which is deprecated btw.. You should probably use mod_wsgi

其他提示

you are probably using Django 1.5 which has stopped to support mod_python

and for switch to wsgi see http://library.linode.com/frameworks/django-apache-mod-wsgi/ubuntu-10.04-lucid

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top