You should use environment variables for this, so:
- this creates the env variable in your heroku application
heroku config:set MAPBOX_TOKEN="pk.fooooooooooooo"
- this loads the env variable in your code
import os
os.getenv('MAPBOX_TOKEN')
- Remove the
config.py
from your.gitignore
You can also manage environment variables in heroku UI in your app settings