gpt4 book ai didi

Django 南 : models are shown as not synced even if they are (or should be)

转载 作者:行者123 更新时间:2023-12-04 05:12:24 27 4
gpt4 key购买 nike

我在同步数据库后得到这个:

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

最佳答案

这只是一个警告,因为这些表由南管理并在同步数据库中被忽略。

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

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

关于Django 南 : models are shown as not synced even if they are (or should be),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14739465/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com