To provide secret keys and some further required configuration details, environment variables are added to the service.
During the development process you may have used an env.py file which contained sensitive information. For the application to perform correctly, this information is required in the production environment. When deploying to Heroku, you probably converted that file to a set of config vars.
You may have access to your env.py
file in a pinned workspace, but not necessarily. Luckily, Render provides a couple of ways to give your application access to these details without exposing them to the public.
This allows the addition of individual environment variables.
This would be a good place for development and debug variables when needed.
This file will be available ‘behind the scenes’, it is not accessible to the public so the security and secrecy of its content are maintained.
This also acts as a nice backup location of production environment variables should a Gitpod workspace be lost without another external backup of the env.py
file.
If you do not have access to a copy of your env.py
file, please follow the steps below. If you do have access, please skip ahead.
Scroll down and click “Advanced”
Click “Add Environment Variable”
Open a new browser tab and navigate to your Heroku dashboard and open the Settings tab of your existing app
Click “Reveal Config Vars”
Copy each config var key and value from Heroku to a new Environment Variable on Render
Key | Value |
---|---|
IP | 0.0.0.0 |
PORT | 5000 |
SECRET_KEY | <your secret key> |
MONGO_URI | <your Mongo URI> |
MONGO_DBNAME | <your MongoDB name> |
The IP
and PORT
variables are used within the Flask application and should not be modified.
If you have access to a copy of your env.py
file, please follow the steps below
Copy the content of your existing env.py
file to your clipboard
Scroll down and click “Advanced”
Click “Add Secret File”
Paste in the copied text to the File contents text area input and ensure the Filename is env.py
Make sure to click "Save" when done.
The final option is whether to Auto-Deploy. The two options are explained in the following page.