如何更改 Heroku 应用程序的 DATABASE_URL [英] How to change DATABASE_URL for a heroku application

查看:22
本文介绍了如何更改 Heroku 应用程序的 DATABASE_URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 heroku 应用程序中使用外部数据库.但我无法编辑配置 cariables.我尝试使用 GUI,上面写着无法覆盖附件值 DATABASE_URL.虽然我也尝试使用 CLI.我使用了命令:heroku config:addDATABASE_URL="postgresql://username:password@IP:PORT".但是,这会引发错误 ... is not a heroku command.

I wanted to use an external Database with my heroku application. But I'm unable to edit the configuration cariables. I tried using GUI, Which says, Cannot overwrite attachment values DATABASE_URL. While I tried using CLI as well. I used the command: heroku config:addDATABASE_URL="postgresql://username:password@IP:PORT". However, this throws an error ... is not a heroku command.

推荐答案

在尝试了大多数这些答案之后,我在 2016 年遇到了更新,这里:需要先去数据库,然后更新DATABASE_URL的变量.

After trying out most these answers, I came across an update in 2016, here: the database needs to be detached first, then update the variable of the DATABASE_URL.

heroku addons:attach heroku-postgresql -a <app_name> --as HEROKU_DATABASE
heroku addons:detach DATABASE -a <app_name>
heroku config:add DATABASE_URL=

这篇关于如何更改 Heroku 应用程序的 DATABASE_URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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