"No such table" 重新部署后
"No such table" after redeploy
我正在尝试在我的应用程序中实现自动迁移。 Procfile
包括:
release: python manage.py migrate
...
2020-08-04T15:01:34.924211+00:00 heroku[run.4178]: State changed from starting to up
2020-08-04T15:01:35.269081+00:00 heroku[run.4178]: Awaiting client
2020-08-04T15:01:35.326202+00:00 heroku[run.4178]: Starting process with command `python manage.py migrate`
2020-08-04T15:01:44.905287+00:00 heroku[run.4178]: Process exited with status 0
2020-08-04T15:01:44.945348+00:00 heroku[run.4178]: State changed from up to complete
但是,如果我尝试将数据加载到数据库中,它会打印:No such table: <>
错误。如果我重新运行 migrate 命令,它会起作用。这里有什么问题?
解决方案是使用 PostgreSQL
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)
我正在尝试在我的应用程序中实现自动迁移。 Procfile
包括:
release: python manage.py migrate
...
2020-08-04T15:01:34.924211+00:00 heroku[run.4178]: State changed from starting to up
2020-08-04T15:01:35.269081+00:00 heroku[run.4178]: Awaiting client
2020-08-04T15:01:35.326202+00:00 heroku[run.4178]: Starting process with command `python manage.py migrate`
2020-08-04T15:01:44.905287+00:00 heroku[run.4178]: Process exited with status 0
2020-08-04T15:01:44.945348+00:00 heroku[run.4178]: State changed from up to complete
但是,如果我尝试将数据加载到数据库中,它会打印:No such table: <>
错误。如果我重新运行 migrate 命令,它会起作用。这里有什么问题?
解决方案是使用 PostgreSQL
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)