2013-11-01 57 views
0

我在Django上啓動了一個項目並將其保存到Github。這是一個虛擬世界。然後我將它從Github下載到另一個virtualenv中,滿足了要求。當我嘗試Django + Mezzanine + Github無法運行項目

(virutalenv)Machine:project user$ python manage.py runserver 
[snip snip] 
Validating models... 

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10ad7cad0>> 
Traceback (most recent call last): 
[snip snip] 
    File "/Users/user/project/lib/python2.7/site-packages/south/db/__init__.py", line 83, in <module> 
    db = dbs[DEFAULT_DB_ALIAS] 
KeyError: 'default' 

而當我嘗試在python中加載設置時,會發生以下情況。這些設置位於項目根目錄下的文件settings.py中。

virtualenv)Machine:project user$ python       
Python 2.7.5 (default, May 19 2013, 13:26:46) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin 
Type "help", "copyright", "credits" or "license" for more information.>>> from django.conf import settings as d_settings 
>>> import settings as my_settings 
>>> d_settings.configure(my_settings, DEBUG=True) 
[snip snip] 
    File "/Users/user/project/lib/python2.7/site-packages/django/conf/__init__.py", line 186, in __getattr__ 
    return getattr(self.default_settings, name) 
AttributeError: 'module' object has no attribute 'LOGGING_CONFIG' 
>>> import mezzanine.conf 
Traceback (most recent call last): 
[snip snip] 
    File "/Users/user/project/lib/python2.7/site-packages/django/conf/__init__.py", line 186, in __getattr__ 
    return getattr(self.default_settings, name) 
AttributeError: 'module' object has no attribute 'DATABASE_ROUTERS' 
>>> 

此pastebin中的整個未切割轉錄本:http://pastebin.com/C8Cy6e6v

該項目運行良好的原始virtualenv。它抱怨ALLOWED_HOSTS沒有設置,但這從來沒有打擾過它。原始數據庫設置是空白的,但這並不妨礙它。我認爲開發數據庫設置在Mezzanine的某個位置,但我不確定它在哪裏。夾層是用所謂的dev.db項目根目錄下有sqlite3的數據庫,但是,再一次,在已設置了,我無法弄清楚。強制第二個virtualenv上的數據庫設置從相同數據庫文件的副本讀取不起作用。

我認爲它只是加載正確的設置的問題,但我不知道他們在哪裏或在哪裏可以找到他們。

回答

0

嗯,我想通了。該命令告訴我,該設置是在默認的local_settings中。

find ~/virtualenv/lib/python2.7/site-packages/mezzanine/ -type f | while read this; do cat $this | grep 'dev\.db' && echo '>>>>>>>>>>>>>>>' $this; done 
     "NAME": "dev.db", 
>>>>>>>>>>>>>>> /Users/eeytan/dd2/lib/python2.7/site-packages/mezzanine//project_template/local_settings.py.template 

然後我發現該默認.gitignore文件有這個文件默認添加。

這可能是明顯的誰downvoted我的人,但我花了很長的時間才能體現出來,因爲我一直在尋找別的地方尋求解決方案。當你知道去哪裏找,這是顯而易見的。 downvoiting的StackOverflow上這種趨勢沒有解釋是非常令人不安的。