Add Postgres To Flask

I have some truble connecting Postgresql to Flask and deploying it to Railway App
No description
42 Replies
Percy
Percy8mo ago
Project ID: c6894929-c040-4842-8c83-4516d57a14fe
IssaKass
IssaKass8mo ago
c6894929-c040-4842-8c83-4516d57a14fe can anyone help me?
Brody
Brody8mo ago
have you added the database variable references to your backend? https://docs.railway.app/guides/variables#referencing-another-services-variable
IssaKass
IssaKass8mo ago
I am new to deploying, its my first app that I will deploy it, it is built with Flask+db+React
Brody
Brody8mo ago
okay that's cool, but that doesn't quite answer the question
IssaKass
IssaKass8mo ago
I added this one only to the backend:
IssaKass
IssaKass8mo ago
could you also provide what to add in .env for flask?
No description
Brody
Brody8mo ago
you don't need an .env file
IssaKass
IssaKass8mo ago
configuration? for example config.py
Brody
Brody8mo ago
this looks good to me, are you using that environment variable in your code
IssaKass
IssaKass8mo ago
yes: FLASK_APP=main FLASK_ENV=development FLASK_DEBUG=True
Brody
Brody8mo ago
I'm sorry but that doesn't answer the question
IssaKass
IssaKass8mo ago
no Just added it to Railway
Brody
Brody8mo ago
you need to use the DATABASE_URL environment variable in code when connecting to the database
IssaKass
IssaKass8mo ago
How?
Want results from more Discord servers?
Add your server