Two apps connected to the same DB

I create a wbesocket app A along with their db B. I want to create a flask app C in parallel. can this app C access the db B attached to the websocket app A?

If not, is anyone has any tips on how to run Flask and websockets in the same app, that would be awesome

Thanks

@johncena yes! That’s what the fly postgres attach command is for. Run it (if B is your DB app’s name: fly postgres attach B) from your Flask app C’s directory (or with the --app C flag).

Usage:
  flyctl postgres attach <POSTGRES APP> [flags]

Flags:
  -a, --app string             Application name
  -c, --config string          Path to application configuration file
      --database-name string   The designated database name for this consuming app.
      --database-user string   The database user to create. By default, we will use the name of the consuming app.
  -h, --help                   help for attach
      --superuser              Grants attached user superuser privileges (default true)
      --variable-name string   The environment variable name that will be added to the consuming app.  (default
                               "DATABASE_URL")
  -y, --yes                    Accept all confirmations

Global Flags:
  -t, --access-token string   Fly API Access Token
      --debug                 Print additional logs and traces
      --verbose               Verbose output

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.