2

我在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)

所以我运行迁移:

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 为这些应用程序创建新表,而我应该使用迁移?

4

1 回答 1

3

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

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

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

于 2013-02-06T22:01:37.470 回答