Mod_wsgi,django和apache无法正常工作 [英] Mod_wsgi , django and apache not working correctly
问题描述
配置:
应用程序位置:/home/cha0s/hello
Application location: /home/cha0s/hello
Wsgi文件目录:/home/cha0s/hello/apache/django.wsgi
Wsgi file directory: /home/cha0s/hello/apache/django.wsgi
django.wsgi
django.wsgi
import os
import sys
path = '/home/cha0s/hello'
if path not in sys.path:
sys.path.append(path)
os.environ['DJANGO_SETTINGS_MODEULE']='hello.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Apache文件:/etc/apache2/sites_available/hello
Apache file : /etc/apache2/sites_available/hello
你好
hello
<VirtualHost *:80>
ServerName blabla.com
DocumentRoot /home/cha0s/hello
WSGIScriptAlias http://blabla.com /home/cha0s/hello/apache/django.wsgi
<Directory /home/cha0s/hello/apache>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
问题:
Question:
所以问题在于它可以正常工作,但是它像打开文件列表一样打开目录,而不像django网站那样打开目录.知道怎么了吗?我在stackoverflow的某个地方读到mod_python可能是问题所在,所以我删除了它.
So the problem is it kind of works , but it opens directory just like a list of files , not like a django website. Any idea whats wrong? I read somewhere on stackoverflow that mod_python may be the problem , so i deleted it .
推荐答案
您需要在sys.path中添加"/home/cha0s".
You need to add '/home/cha0s' to sys.path.
也要注意:
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm = 6#Conference_Presentations
这说明了您可能会出错的其他情况,但是由于您没有解释错误所在,因此很难分辨出其他错误.
This explains other things you could have got wrong, but since you don't explain what the error is you are getting, hard to tell what else is broken.
这篇关于Mod_wsgi,django和apache无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!