运行 Heroku 中的两个应用程序并使用 PostgreSQL 数据库连接它们
Run two applications in Heroku and connect them using the PostgreSQL database
我正在尝试使用 Python 和 Heroku 构建一个全栈网络应用程序。
有两个应用程序,它们使用公共数据库 (Heroku Postgres) 连接。后端应用程序从 Twitter 流式传输实时推文并将其存储在数据库中。在前端 plotly-dash 应用程序中,用户可以提供输入查询,查询的情绪会实时显示。该应用程序完美地 运行 在我的本地服务器上。但是当我尝试在 Heroku 中部署它时,我发现部署这两个应用程序很困难。
我是否应该使用两个应用程序分别部署应用程序?如果可以,如何连接到公共数据库?
Am I supposed to deploy the apps separately using two applications?
是的。
Heroku 旨在一次部署一项服务。每个应用程序一个应用程序。
If so, how can I connect to the common database?
使用 Heroku Postgres 插件创建一个应用程序,然后 add a second application to the existing database:
heroku addons:attach <heroku-addon-name> -a <app-name>
我正在尝试使用 Python 和 Heroku 构建一个全栈网络应用程序。
有两个应用程序,它们使用公共数据库 (Heroku Postgres) 连接。后端应用程序从 Twitter 流式传输实时推文并将其存储在数据库中。在前端 plotly-dash 应用程序中,用户可以提供输入查询,查询的情绪会实时显示。该应用程序完美地 运行 在我的本地服务器上。但是当我尝试在 Heroku 中部署它时,我发现部署这两个应用程序很困难。
我是否应该使用两个应用程序分别部署应用程序?如果可以,如何连接到公共数据库?
Am I supposed to deploy the apps separately using two applications?
是的。
Heroku 旨在一次部署一项服务。每个应用程序一个应用程序。
If so, how can I connect to the common database?
使用 Heroku Postgres 插件创建一个应用程序,然后 add a second application to the existing database:
heroku addons:attach <heroku-addon-name> -a <app-name>