Issue loading python env variable with getenv()

I set a variable with in the UI for dbsslmode to require but it does not seem to load. assert getenv("dbsslmode") == "require"
File "/app/fb_models.py", line 16, in <module>
assert getenv("dbsslmode") == "require"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
File "/app/fb_models.py", line 16, in <module>
assert getenv("dbsslmode") == "require"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
I added this assert because I was getting a None type error on the env variable. I must be doing something stupid. I am using load_dotenv() but I dont this this is causing the issue.
Solution:
you have not deployed any of the changes
Jump to solution
14 Replies
Percy
Percy5mo ago
Project ID: b5f44aa4-5dc9-4336-9f3a-920b1aecc01b
VincentDavis
VincentDavis5mo ago
project ID b5f44aa4-5dc9-4336-9f3a-920b1aecc01b
Brody
Brody5mo ago
a production app running on railway would not need to call load_dotenv() because railway has service variables that get automatically injected into the environment, have you set your desired variable there?
VincentDavis
VincentDavis5mo ago
I have setup the variable. My understanding is that load_dotenv() won’t have cause any issue, I need this for local testing so would prefer to leave it.
Brody
Brody5mo ago
please send a screenshot of your service variables tab
VincentDavis
VincentDavis5mo ago
Ok, 5min
VincentDavis
VincentDavis5mo ago
Sorry for the delay
No description
Solution
Brody
Brody5mo ago
you have not deployed any of the changes
VincentDavis
VincentDavis5mo ago
No description
Brody
Brody5mo ago
click the big blue Deploy button
VincentDavis
VincentDavis5mo ago
Not sure what you mean?
Brody
Brody5mo ago
at the top it shows you that you have pending changes
VincentDavis
VincentDavis5mo ago
I new it was something stupid! Thank you!
Brody
Brody5mo ago
no problem
Want results from more Discord servers?
Add your server