我正在嘗試使用wsgi
部署django
。但它不工作。你能幫我嗎?謝謝使用apache部署django,mod-wsgi
django.wsgi.py
#!/usr/bin/python
import os, sys
sys.path.append('/home/me/project')
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
/etc/apache2/sites-available/default
<VirtualHost *:80>
ServerName www.me.org
ServerAlias *me.org
Alias /admin_media /usr/lib/python2.4/site-packages/django/contrib/admin/media
<Location /admin_media>
Order allow,deny
Allow from all
</Location>
Alias /media /var/www/media/
<Location /media>
Order allow,deny
Allow from all
</Location>
WSGIScriptAlias//home/me/project/apache/django.wsgi
WSGIDaemonProcess me processes=2 maximum-requests=500 threads=1
WSGIProcessGroup me
</VirtualHost>
Error Message
/etc/init.d/apache2 restart
Syntax error on line 3 of /etc/apache2/sites-enabled/me:
Invalid command 'PythonHandler', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
UPDATE:奇怪/etc/apache2/sites-enable/me
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonDebug On
PythonPath "['/home/me2'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE me.settings
我可以禁用mod-python嗎?
提供我們缺少的文件/ etc /啓用網站/我的Apache2 /文檔。或者這是/ etc/apache2/sites-available/default的符號鏈接? –
@密度21.5對不起 – Kulbir
@密度21.5查看更新 – Kulbir