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 Ø
請幫助我瞭解,我有我錯過