Django在Heroku上-/关系“ ...”处的ProgrammingError不存在 [英] Django on Heroku - ProgrammingError at / relation "..." does not exist

查看:57
本文介绍了Django在Heroku上-/关系“ ...”处的ProgrammingError不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到错误。我知道您通常会收到此错误,因为数据库没有正确迁移。

I'm getting this error. I know you usually get this error because the databases wasn't properly migrated.

当我运行 heroku本地网络 ,当我进入 localhost:5000 时,网站运行正常。

When I run heroku local web, the website works fine when I go to localhost:5000.

但是我将应用程序部署到heroku后, git push heroku master ,出现错误。

However after I deploy the app to heroku with git push heroku master, the error comes up.

换句话说,它在我的本地环境中有效。

In other words, it works in my local environment. But it does not work after deploying to heroku.

我在Heroku中安装了Heroku-Postgres作为附件。

I have Heroku-Postgres installed as an add-on in heroku.

这可能是什么原因?

推荐答案

在bash heroku中执行迁移和makemigrations。在本地项目文件夹中打开终端,然后输入以下命令:

excute migrations and makemigrations in bash heroku. open the terminal in the local project folder and give the following commands:

heroku run bash
~$  ./manage.py makemigrations
~$  ./manage.py migrate
~$  exit

这篇关于Django在Heroku上-/关系“ ...”处的ProgrammingError不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆