Setting config / environment variables on Heroku
When working on your project, your code has two separate environments. Your local one, within your IDE, and the deployed environment on Heroku.If you have followed good practice, you have set up your environment variables for your project in a file that is not sent to git.
As Heroku uses your repository code to build the deployed site, it won't have access to those environment variables in your local file, and it will throw errors at you. So when deploying, it is important to give Heroku its own copy of your environment variables. To do this:
- Log into Heroku
- Open the app dashboard for your Heroku app
- Click on Settings
- Click on Reveal Config Vars
Make sure you have set:
IP as the key with a value of 0.0.0.0
PORT as the key with a value of 8080
You can add any other environment variables the project needs in the same way. So for example, if you have set your local environment variable of SECRET_KEY = "whatever" then add them to the Heroku config vars too. with SECRET_KEY as the key with a value of whatever
(without the "" around it)
More on how to set environment variables here: https://code-institute-room.slack.com/archives/CP07TN38Q/p1576743956008500