【问题标题】:"No such table" after redeploy重新部署后“没有这样的表”
【发布时间】:2020-08-04 15:09:32
【问题描述】:

我正在尝试在我的应用程序中实现自动迁移。 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 命令,它会起作用。这里有什么问题?

【问题讨论】:

    标签: python database heroku migration heroku-postgres


    【解决方案1】:

    解决办法是使用PostgreSQL

    db_from_env = dj_database_url.config()
    DATABASES['default'].update(db_from_env)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-20
      • 2023-03-21
      • 1970-01-01
      • 2018-01-18
      • 2021-05-08
      • 2011-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多