安装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)),
    )