gpt4 book ai didi

Django 1.7 makemigrations 没有效果

转载 作者:行者123 更新时间:2023-12-02 07:06:18 26 4
gpt4 key购买 nike

我一直在我的heroku服务器上运行python manage.py makemigrations,但无论我运行多少次,我都会得到:

$heroku run python manage.py makemigrations
Running `python manage.py makemigrations` attached to terminal... up, run.2680
Migrations for 'default':
0002_auto_20141120_2007.py:
- Alter field user on usersocialauth

如果我运行heroku run python manage.py migrate

它返回:

Running `python manage.py migrate` attached to terminal... up, run.1285
Operations to perform:
Synchronize unmigrated apps: baflist_core, rest_framework, localflavor, storages
Apply all migrations: admin, userAccount, contenttypes, sessions, default, location, messaging, forum, auth, posts
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

诚然,我对 postgres 和迁移的了解只够危险的,所以我想我应该在这里问。有人遇到过这个吗?

最佳答案

本地迁移完成后,您应该在 <your django app>/migrations 上拥有迁移文件文件夹 Ex(restapi 是我的 django 应用程序):

/Django/app/folder/restapi/migrations$ ls
0001_initial.py 0001_initial.pyc __init__.py __init__.pyc

所以你应该手动提交迁移文件:

heroku$ git commit restapi/migrations/0001_initial.py -m "migrations file"
heroku$ git push heroku master

注意:Heroku 不会在您的应用程序上自动运行迁移!我已经检查过了!推送文件后,您应该为您的应用程序运行 migrate:

heroku$ heroku run python manage.py migraterestapi运行python manage.py migrate restapi连接到终端...启动,运行.4602要执行的操作: 应用所有迁移:restapi运行迁移: 正在应用restapi.0001_initial...好的

关于Django 1.7 makemigrations 没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27048631/

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