Setting Up Environment Variables for the Heroku App
We previously modified config.py
and added ProductionConfig
there. Now we have to add the environment variables in Heroku, including the secret key and database URL. In addition to these, let's not forget the Mailgun API key and the Mailgun domain as well. We will set up all of these together in the next exercise.
Exercise 67: Setting Up the App Environment Variables
In this exercise, we will set up the environment variables in the production environment. Fortunately, because we are using Heroku Postgres, the database URL environment variable has already been set up for us. We only need to set ENV
, SECRET_KEY
, MAILGUN KEY
, and DOMAIN
. Then, once the setting is complete, after the Deploy
code is completed, the application will read the newly added environment variables in App config
:
- Generate the secret key using the following two lines of code in the Python console in PyCharm:
>>>import os >>>os...