2013-10-09 47 views
0

我想使用apache2来运行我的django应用程序,但是我失败了。它给我一个500内部服务器错误说 The server encountered an internal error or misconfiguration and was unable to complete your request. 首先,我在我的主目录创建一个firstweb.wsgi文件。并把这个代码如何为django wsgi配置apache2?

import os 
import sys 
sys.path = ['/var/www/firstweb'] + sys.path 
os.environ['DJANGO_SETTINGS_MODELE'] = 'firstweb.settings' 
import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

在我/etc/apache2/sites-available我创建了一个名为firstweb.conf 在firstweb.conf我有这样的代码

<VirtualHost *:80> 
WSGIScriptAlias//home/nihan/firstweb.wsgi 

ServerName firstweb.com 
Alias /static /var/www/firstweb/static 

<Directory /var/www/firstweb/ > 
Order allow,deny 
Allow from all 
</Directory> 
</VirtualHost> 

,并在文件中我/var/www/我创建了一个Django项目通过键入

sudo django-admin.py startproject firstweb 

这是我第一次尝试apache,mod_wsgi和Djang Ø

请帮助我了解,我有我错过

回答