I have an application that uses some environments variables like host, users, dbname to protect sensive data in a database connection. In local ambient, using localhost with Pycharm IDE that works fine!!! But when I upload code to Heroku, it don´t recognize my environment variables and app crashes.
Here is small code showing how I call variables at Pycharm IDE. That is fine for localhost:
> import psycopg2 import os> > host = os.environ['HOST'] dbname = os.environ['dbname'] user => os.environ['user'] password = os.environ['password'] porta => os.environ['porta']> > print(host) >print(dbname) >print(user) >print(password) >print(porta)
In Heroko, config var are equal variables above, follow print os settings:
Well, any suggestions to solve this problem? How can I adapt code to run in Heroku app?
Thx