请问fedora19部署django+apache2不成功如何调试,fedora19django,我在/var/www/h


我在/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.wsgiapplication = 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

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

推荐使用uwsgi

pip install uwsgiuwsgi --socket 127.0.0.1:3031 --chdir /home/foobar/myproject/ --wsgi-file myproject/wsgi.py --master --processes 4 --threads 2 --stats 127.0.0.1:9191

也可以把命令放入ini文件中,例如:

[uwsgi]socket = 127.0.0.1:3031chdir = /home/foobar/myproject/pythonpath = ..env = DJANGO_SETTINGS_MODULE=myproject.settingsmodule = django.core.handlers.wsgi:WSGIHandler()processes = 4threads = 2stats = 127.0.0.1:9191

然后执行:

uwsgi yourfile.ini

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

编橙之家文章,

评论关闭