django south:模型显示为未同步,即使它们(或应该是)

时间:2013-02-06 21:48:14

标签: django django-south migrate syncdb

我在syncdb之后得到这个:

clime@den /var/www/loserti $ ./manage.py syncdb
Syncing...
Creating tables ...
Creating table tagging_tag
Creating table tagging_taggeditem
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.messages
 > django.contrib.staticfiles
 > django.contrib.admin
 > django.contrib.admindocs
 > django.contrib.flatpages
 > debug_toolbar
 > filebrowser
 > grappelli
 > tagging
 > south

Not synced (use migrations):
 - photologue
 - web
(use ./manage.py migrate to migrate these)

所以我运行migrate:

clime@den /var/www/loserti $ ./manage.py migrate
Running migrations for photologue:
- Nothing to migrate.
 - Loading initial data for photologue.
Installed 0 object(s) from 0 fixture(s)
Running migrations for web:
- Nothing to migrate.
 - Loading initial data for web.
Installed 0 object(s) from 0 fixture(s)

但syncdb的结果仍然相同:

clime@den /var/www/loserti $ ./manage.py syncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.messages
 > django.contrib.staticfiles
 > django.contrib.admin
 > django.contrib.admindocs
 > django.contrib.flatpages
 > debug_toolbar
 > filebrowser
 > grappelli
 > tagging
 > south

Not synced (use migrations):
 - photologue
 - web
(use ./manage.py migrate to migrate these)

这怎么可能以及如何解决?

编辑:这是一个微弱的想法。可能是因为我在某些时候使用了./manage.py syncdb来为这些应用创建新表而我应该使用迁移吗?

1 个答案:

答案 0 :(得分:3)

这只是一个警告,因为这些表由south管理,在syncdb上被忽略。

一种解决方案是将所有表格转换为南方,并始终运行migrate而不是syncdb。我假设您可以通过某种方式编辑manage.py来运行迁移,而不是返回消息。

如果您不再使用南方这些应用程序,请删除应用程序中的迁移目录。