首页 文章

Django和South:南方没有检测到django模型何时发生变化

提问于
浏览
0

我整天都在努力做这项工作,但我做不到 .

这是我到目前为止所做的:

  • 创建了一个应用程序及其模型(此时没有南)

  • 在我的系统上安装了South

  • 已将'south'添加到我的项目设置中

  • 使用manage.py syncdb创建南迁移表

  • 使用以下方法将我的应用转换为南:manage.py convert_to_south myapp . 这创建了一个迁移文件夹和一个初始迁移文件 .

  • 更改了我的模型(添加了一个新字段)

  • Ran manage.py schemamigration myapp --auto

  • 它说 NOTHING SEEMS TO HAVE CHANGED.

这是我原来的型号:https://gist.github.com/kustomrtr/8f4f4262634904b53d5f

这是我的MODIFIED模型(添加第41行):https://gist.github.com/kustomrtr/edab10975803c74b869a

这是我的初始迁移文件(当我将应用程序转换为南方时创建):https://gist.github.com/kustomrtr/2a4884be3177225a45e7

你能帮我吗!

提前致谢 .

1 回答

  • 1

    有人指出我的模型中的 Manage = False 可能会造成麻烦 . 我试着评论那些线并猜测:

    C:\Users\Kevin\Desktop\difundelo>python manage.py schemamigration registros --auto
     ? The field 'Post.image' does not have a default specified, yet is NOT NULL.
     ? Since you are adding this field, you MUST specify a default
     ? value to use for existing rows. Would you like to:
     ?  1. Quit now, and add a default to the field in models.py
     ?  2. Specify a one-off value to use for existing columns now
     ? Please select a choice:
    

    瞧!有效!我终于可以继续我的项目了!

    PS:我不知道为什么评论解决方案的人,删除了他的评论 . 谢谢匿名!!!

相关问题