只需使用Bitnami DjangoStack映像設置64位ubuntu EC2實例即可。Apache,mod_wsgi和Django配置的問題
到目前爲止,我已經安裝了幾個python依賴項,並刪除了默認創建的Project django應用程序。我用'django-admin.py startproject projectname'創建了一個新應用程序。然後我按照這裏的說明:http://wiki.bitnami.org/Components/Django,試圖設置Apache。
這裏是我的projectname.conf文件:
Alias /static "/opt/bitnami/apps/django/lib/python2.7/site-packages/django/contrib/admin/static"
<Directory '/opt/bitnami/apps/django/lib/python2.7/site-packages/django/contrib/'>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /URL_mount_point "/opt/bitnami/apps/django/scripts/projectname.wsgi"
<Directory '/opt/bitnami/apps/django/scripts'>
Order allow,deny
Allow from all
</Directory>
這裏是我的projectname.wsgi
import os, sys
sys.path.append('/opt/bitnami/apps/django/django_projects')
sys.path.append('/opt/bitnami/apps/django/django_projects/projectname')
os.environ['DJANGO_SETTINGS_MODULE'] = 'projectname.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
下面是最後三行我的httpd.conf中:
Include "/opt/bitnami/apache2/conf/ssi.conf"
Include "/opt/bitnami/apache2/conf/bitnami/httpd.conf"
Include "/opt/bitnami/apps/django/conf/projectname.conf"
執行此操作並重新啓動apache後,點擊mydomain.com/projectname仍然會出現404(Bitnami登錄頁面在mydomain.com上出現就好了)。
我在這裏錯過了什麼嗎?我在projectname.wsgi中的路徑不正確(我沒有偏離默認的Bitnami目錄結構)。還是有一些額外的步驟,我在這裏失蹤?