2010-12-14 94 views
3

我決定看看django-cms。看文檔之後,我克隆使用如何啓動django cms項目

git clone https://github.com/divio/django-cms.git 

庫然後,我用

sudo python setup.py install 

我已經有Django的1.2.3安裝安裝它。我搬到了example目錄中的RAN syncdb它創建以下表:

Creating table auth_permission 
Creating table auth_group_permissions 
Creating table auth_group 
Creating table auth_user_user_permissions 
Creating table auth_user_groups 
Creating table auth_user 
Creating table auth_message 
Creating table django_content_type 
Creating table django_session 
Creating table django_admin_log 
Creating table django_site 
Creating table sampleapp_category 
Creating table sampleapp_picture 
Creating table south_migrationhistory 



You just installed Django's auth system, which means you don't have any superusers defined. 
Would you like to create one now? (yes/no): yes... 

我們可以清楚地看到,不創建CMS表。運行服務器和瀏覽http://localhost:8000/

DatabaseError: no such table: cms_page 

我看過的文檔,並看到了,我就滿足了版本的要求,但很顯然,我做錯事的時候,我明顯面臨這個問題。任何幫助將不勝感激。

+0

該應用是否在項目的設置文件中啓用?我認爲這很可能是問題所在。 – 2010-12-14 11:29:51

回答

7

django-cms使用South進行數據庫遷移。由South處理的模型沒有使用syncdb同步到數據庫。你必須使用manage.py migrate

既然你沒有從Django的CMS任何表格和數據遷移,更快的解決方案將是這一過程:

  • 註釋掉'south'INSTALLED_APPS
  • 運行manage.py syncdb(這將創建從Django的CMS中的所有表)
  • INSTALLED_APPS
  • 運行南部重新啓用manage.py migrate --fake

當您下次更新django-cms時,您可以運行manage.py migrate來更新您的數據庫表。

+0

是的,我遵循這個原則,因爲我已經用南方的其他項目。我認爲問題在於僞造遷移,而不是在之後使用'migrate --all' – booyakah 2010-12-14 13:43:55

1

Did you put 'cms' in INSTALLED_APPS in settings.py? Django-CMS還需要安裝menus,publishermptt以及一些中間件。 This is some nice to read documentation就可以了!

+0

感謝您的回答,我也通過了該教程。我沒有觸及到示例中的settings.py,它包含了cms,menus,publisher和mptt,我可以在python shell中導入它們。 – booyakah 2010-12-14 12:58:22

0

一般來說,如果表未建立有可以在應用程序本身的一些錯誤: 嘗試運行Django的外殼並從應用程序中導入模型:

python manage.py shell 

>>> from csm import models 

和檢查,如果你得到一個回溯。

希望這可以幫助。