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?
Found the solution: just do
MONGO_URI = os.environ.get('MONGO_URI')
This way there will be no error due to missing variable
Tadej Svetina
In my settings.py file I use an environmental variable, like this:
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?