2014-02-15 70 views
3

我正在運行一個以前在django 1.4上運行的站點,但現在我將它轉移到了django 1.6上。無法在Apache服務器上運行我的Django站點(版本1.6)

我能夠使用python manage.py shell在兩個版本上運行我的網站。

我在Apache上很好地運行它,當我在Apache網站啓用時保留django 1.4虛擬環境python路徑,但是當我在那裏保留django 1.6虛擬環境python路徑時它不工作。

Django的1.6,它拋出錯誤:

ImproperlyConfigured: Requested setting DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings

可以採取什麼問題?在django 1.6的wsgi.py文件中所需的任何更改?請幫忙。

我的虛擬主機文件是:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /home/vidya/workspace/vidya/vidya_rose/cms/trunk/demo/ 
    ServerName www.vidblog.com 
    <Directory /home/vidya/workspace/vidya/vidya_rose/cms/trunk/demo> 
      #Order deny,allow 
      #Allow from all 
      Options FollowSymLinks 
      AllowOverride None 
    </Directory> 
    Alias /media /home/vidya/workspace/vidya/vidya_rose/cms/trunk/demo/vidyamedia/ 
    Alias /static /home/vidya/workspace/vidya/vidya_rose/cms/trunk/demo/static/ 
    WSGIDaemonProcess www.demo.com user=www-data group=www-data processes=8 threads=75\ 
    python-path=/home/vidya/workspace/djnago1.6/lib/python2.7/site-packages 
    WSGIProcessGroup www.vidblog.com 
    WSGIScriptAlias//home/vidya/workspace/vidya/vidya_rose/cms/trunk/demo/demo/wsgi.py 
</VirtualHost> 
+0

請說明您的升級過程;和你的文件系統佈局。 –

+0

是你的python路徑真的djnago1.6不是django1.6?只是想知道是否它的錯字:) –

回答

6

這是當你遷移你的舊項目從Django的1.x的(< 1.6)到你需要你打電話之前定義DJANGO_SETTINGS_MODULEdjango-1.6問題get_wsgi_application

import os 
import sys 

sys.path.append(os.path.dirname(os.path.dirname(__file__))) 
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yourproject.settings") 

from django.core.wsgi import get_wsgi_application 
application = get_wsgi_application() 
+0

謝謝你的幫助...真的很感激它... !!! –

相關問題