Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Config var does not work in python Heroku app

$
0
0

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:

My var config in Heroku app

Well, any suggestions to solve this problem? How can I adapt code to run in Heroku app?

Thx


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>