DB not recognizable

No description
20 Replies
Percy
Percy4mo ago
Project ID: 42cb5f33-ac30-472f-be18-06847d544555
curiebufferfinance
42cb5f33-ac30-472f-be18-06847d544555
Brody
Brody4mo ago
going to need more information, are you trying to connect to a database hosted on railway?
curiebufferfinance
Yes postgres hosted on railway in the same project. I have added DATABASE_URL as the env variable but its still throwing this error. I have multiple such projects running and everything works fine. Only in this project i am facing this issue.
Brody
Brody4mo ago
show me the code that connects to the database please
Brody
Brody4mo ago
show me where that database url variable is defined please
curiebufferfinance
Its defined in settings.py Lastly i am doing this
No description
No description
Brody
Brody4mo ago
that's an empty string? it should load the value from the environment variables
curiebufferfinance
Settings.py imports BaseSetting which directly loads the env variables
No description
curiebufferfinance
The empty string was the placeholder value
Brody
Brody4mo ago
have you done the classic debugging technique of printing the variable that you use in tortoise?
curiebufferfinance
Yes it is getting recognized I am getting the db value @Brody any idea on how i can fix this
Brody
Brody4mo ago
at first glace this is kinda looking like its loading variables from a file?
curiebufferfinance
I tried logging the db url that the app is connecting to and the url looks fine.
Brody
Brody4mo ago
its printing the scheme blank in your screenshot
No description
curiebufferfinance
Logged the db here
No description
Brody
Brody4mo ago
right but seems like tortoise is ending up with a bad url
curiebufferfinance
Any idea how i can debug that?
Brody
Brody4mo ago
print the same value you are passing to tortoise, not just the environment variable