python no such table_安装django south报错no such table: south_migrationhistory

本文解决在使用Fabric-Bolt时遇到的“relation 'south_migrationhistory' does not exist”错误。通过激活环境、修改配置文件及执行特定命令来解决该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装django south,执行python manage.py migrate app_name的时候报错:no such table: south_migrationhistoryFor 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_toolbarif settings.DEBUG:

import debug_toolbar

urlpatterns += patterns('',

url(r'^__debug__/', include(debug_toolbar.urls)),

)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值