【发布时间】:2013-10-09 02:43:58
【问题描述】:
我试图使用 apache2 运行我的 django 应用程序,但失败了。它给了我一个 500 内部服务器错误说
The server encountered an internal error or misconfiguration and was unable to complete your request.
首先,我在我的主目录中创建了一个 firstweb.wsgi 文件。并把这段代码
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/ 中,我通过键入
sudo django-admin.py startproject firstweb
这是我第一次尝试 apache、mod_wsgi 和 Django
请帮助我了解我是否错过了
【问题讨论】:
标签: python django apache2 mod-wsgi