【发布时间】:2018-09-11 09:11:34
【问题描述】:
我在以下位置尝试了 heroku 节点示例: https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
并使用 Postgres 作为数据库。
一切正常。
现在我想在本地运行它,所以我使用了以下示例: https://devcenter.heroku.com/articles/heroku-local
要将 DATABASE_URL 获取到我的 .env 文件 - 但即使我在本地运行 Heroku 时它也无法正常工作:
[OKAY] Loaded ENV .env File as KEY=VALUE Format
数据库仍然没有连接,当我添加时:
console.log(process.env.DATABASE_URL);
它将 undefined 写入控制台。
【问题讨论】:
-
在遇到此问题后创建了一篇关于如何解决此问题的简短博文:jtrocinski.com/posts/Heroku-Running_a_Python_App_Locally.html
标签: heroku heroku-postgres heroku-cli