【发布时间】:2014-04-11 20:10:38
【问题描述】:
我使用的是 ubuntu 12.04,我做了以下操作:
sudo apt-get install python-mysql
sudo python setup.py install (安装 Django 1.6.2)
sudo apt-get install mysql-server-...
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi
这是我的配置文件:
/home/firstweb.wsgi:
import os
import sys
sys.path = ['/var/www/firstweb'] + sys.path
os.environ['DJANGO_SETTINGS_MODULE'] = 'firstweb.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
/etc/apache/sites-availables/firstweb.conf:
<VirtualHost *:80>
WSGIScriptAlias / /home/adel/firstweb.wsgi
ServerName firstweb.com
Alias /static /var/www/firstweb/static/
<Directory /var/www/firstweb/>
order allow,deny
Allow from all
</Directory>
</VirtualHost>
然后我做了:
a2ensite firstweb.confcd /var/www/django-admin.py startproject firstweb-
apachectl restart vi /etc/hosts
并添加以下内容(192.168.0.123 是我的 wlan ip)
192.168.0.123 firstweb.com
我使用 mysql 并创建了一个数据库并更改了 settings.py 和 syncdb 工作正常
但是当我在浏览器中输入 www.firstweb.com 时,会出现 Apache 的默认页面(它可以工作....)
并且没有出现Django默认页面!!
我的配置有什么问题?
谢谢。
【问题讨论】:
标签: python django apache ubuntu