安裝django south,執行python manage.py migrate app_name
的時候報錯:
no such table: south_migrationhistory
按官方文檔http://south.readthedocs.org/en/latest/tutorial/part1.html一樣報錯。google一下
http://stackoverflow.com/questions/5687627/django-south-error-with-initial-migration,要先執行./manage.py syncdb才行!
For a new Django project and app, I had to perform the following steps: 1.Add South to INSTALLED_APPS in settings.py, but do not add your apps 2.Run syncdb to add the Django and South tables to the database. South modifies syncdb, so it's important to have South in your INSTALLED_APPS. 3.Add apps to INSTALLED_APPS in settings.py 4.Run python manage.py schemamigration app_name --initial for each app (4、5之間執行python manage.py syncdb!) 5.Run python manage.py migrate app_name
————————————————————分割線————————————————————
安裝fabric-blot,執行fabric-bolt migrate報錯:
DatabaseError: relation "south_migrationhistory" does not exist LINE 1: ...gration", "south_migrationhistory"."applied" FROM "south_mig...
首先,執行source /www/fabric-bolt/bin/activate。修改fabirci-bolt目錄(/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt)的manage.py中的"fabric_bolt.core.settings.local"爲"fabric_bolt.core.settings.settings",
其次,在執行fabric-bolt init的時候要指定路徑,匹配manage.py中的"fabric_bolt.core.settings.settings"(或者通過設置環境變量FABRIC_BOLT_CONF指定):
fabric-bolt init /www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/settings/settings.py
再次,執行python manage.py syndb,問題解決!
注意:後面執行createsuperuser,runserver的時候最好也指定路徑,防止報錯:
fabric-bolt --config=/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/settings/settings.py createsuperuser fabric-bolt --config=/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/settings/settings.py runserver
————————————————————分割線————————————————————
執行
fabric-bolt --config=/www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/settings/settings.py runserver
報錯:
\u'djdt' is not a registered namespace
解決:
vim /www/fabric-bolt/lib/python2.7/site-packages/fabric_bolt/core/urls.py
加一句import debug_toolbar
if settings.DEBUG: import debug_toolbar urlpatterns += patterns('', url(r'^__debug__/', include(debug_toolbar.urls)), )