Deploying with environmental variables

Posted about 4 years ago by Tadej Svetina

Post a topic
Un Answered
T
Tadej Svetina

In my settings.py file I use an environmental variable, like this:


 

MONGO_URI = os.environ['MONGO_URI']

However, when I deploy the project I get an error about this key (MONGO_URI) not existing. 


I know I can set this key in Scapringhub settings, but I have to comment the line out for the deploy to work. Is there any way around this?


0 Votes


1 Comments

T

Tadej Svetina posted about 4 years ago

Found the solution: just do


 

MONGO_URI = os.environ.get('MONGO_URI')

 This way there will be no error due to missing variable

0 Votes

Login to post a comment