在fedora19上部署django+apache2失败


我在/var/www/html下执行:


 django-admin.py startproject mysite

然后创建/var/www/html/mysite/django.wsgi文件:


 import os, sys                                                                                
sys.path.append('/var/www/html/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

再修改/etc/httpd/conf/httpd.conf文件,在其最后添加:


 LoadModule wsgi_module modules/mod_wsgi.so
<VirtualHost 222.200.189.79:80>
   ServerName 222.200.189.79:80
   DocumentRoot /var/www
   WSGIScriptAlias / /var/www/html/mysite/django.wsgi
   <Directory /var/www/html/mysite> 
      Order Deny,Allow 
      Allow from all 
    </Directory>
</VirtualHost>

最后重启apache服务:


 sudo httpd -k restart

但是访问 http://localhost 只能看到apache的欢迎页面,看不到django的页面,访问 http://localhost/admin 则是Not found

请问我的操作有什么问题吗?

python apache web django

工大的天天 11 years, 5 months ago

LoadModule python_module /usr/lib/apache2/modules/mod_python.so 没加载吧。

zzaaa answered 11 years, 5 months ago

Your Answer