我有一台使用 Django 的服务器。我正在尝试将我的数据库从 sqlite3 切换到 mysql。以前在 sqlite3 上一切正常。但是,当我使用 mysql 并执行
python manage.py syncdb
我没有收到任何错误,但是没有创建 models.py 中指定的表。仅创建以下表:
[ec2-user@domU-12-31-39-0F-D2-F3 prototype]$ python manage.py syncdb
Syncing...
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table south_migrationhistory
有人知道为什么吗?
最佳答案
看起来您使用的是南方。通常 South 会禁止在 syncdb 中创建大多数表,并且您应该运行 South 迁移以首次创建它们。这样 South 就可以跟踪您的表的状态并应用您拥有的任何特殊迁移规则,即使是在最初。
另一种可能性是您没有在设置文件的 INSTALLED_APPS
变量中列出所有应用。
关于mysql - django mysql syncdb 不在 models.py 中创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16466335/