【发布时间】:2013-11-17 04:32:02
【问题描述】:
我正在尝试通过设置我在 github 上找到的项目之一来学习 Django。之后我运行了它显示的 syncdb 命令 未同步(使用迁移): - django_extensions - djangoatings - 配置文件 - 监护人 (使用 ./manage.py migrate 迁移这些)。
当我运行“python manage.py migrate app”时,它给出了 AttributeError:“模块”对象没有“迁移”属性。
我还运行了 schemamigration app --auto 和 --initial。但似乎没有任何效果。谁能指出我哪里出错了。
【问题讨论】:
-
如果您刚刚开始,请删除您的迁移目录,然后运行您的 schemamigration --initial,然后运行 syncdb。
-
@ZackArgyle ,当我运行时---->python manage.py schemamigration profiles --initial 在 '\profiles\migrations' 处创建迁移目录... 创建 init .py in '\profiles\migrations'... + 添加了模型profiles.Project + 添加了模型profiles.UserProfile + 添加了模型profiles.SavedResource + 在profiles.SavedResource 上添加了['user', 'resource'] 的唯一约束 + 添加模型profiles.TopicFollow + 在profiles.TopicFollow Created 0001_initial.py 上为['user', 'topic'] 添加了唯一约束。您现在可以通过以下方式应用此迁移:./manage.py migrate profiles
-
@ZackArgyle: 但是下一个命令给出了同样的错误,当我运行时----->python manage.py migrate profile es AttributeError: 'module' object has no attribute 'Migration'跨度>
-
syncdb 在你迁移之前,在 schemamigration --initial 之后
-
@ZackArgyle:我当然这样做了 :)
标签: python django django-south