Django/South python manage.py migrate CaseReport raises an exception 转换为 中文

2024-09-28 01:58:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试向现有的Django应用程序添加South支持。在

我所做的:

pip install south
Add 'south' to INSTALLED_APPS in settings.py

Test that South is now there:
$ python manage.py shell
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import south
>>>

Also, check that South shows up in manage.py help:

python manage.py help

python manage.py syncdb

Make south manage your models:

python manage.py convert_to_south CaseReport

On other instances:
manage.py migrate app_name 0001 --fake

Make your model changes in models.py

Check what -would- happen (dry run):

python manage.py schemamigration CaseReport --auto --stdout

Run it for real:
python manage.py schemamigration CaseReport --auto

Finally:
python manage.py migrate CaseReport
...but this is tracebacking for me.  :(

我得到的回溯是:

^{pr2}$

有人知道我做错了什么吗?在

我使用的是django1.6和minicondacpython 2.7.5、south0.8.4和MySQL 5.5.37-0ubuntu0.13.10.1。在

谢谢!在


Tags: toinpyforyourmakethatmanage
1条回答
网友
1楼 · 发布于 2024-09-28 01:58:22

我也遇到了同样的问题,花了好几个小时应用不同的解决方案。问题是MySQL用户可能没有操作表的权限,或者数据库中存在回滚测试表。我两个都有,所以也许这会对某些人有所帮助:

授予用户对数据库所需的权限,然后刷新权限以使其生效:

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX 
    ON `databasename`.* TO 'username'@'ip.address' IDENTIFIED BY 'somepass';
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'username'@'ip.address';

删除表回滚测试(如果有):

^{pr2}$

然后移民顺利进行。在

相关问题 更多 >

    热门问题