Heroku allows you to use configuration variables to control your application. Here is an example of my config.py file, which is inside my flash application:
import os # flask PORT = int(os.getenv("PORT", 5000)) basedir = str(os.path.abspath(os.path.dirname(__file__))) SECRET_KEY = str(os.getenv("APP_SECRET_KEY")) DEBUG = str(os.getenv("DEBUG")) ALLOWED_EXTENSIONS = str(os.getenv("ALLOWED_EXTENSIONS")) TESTING = os.getenv("TESTING", False) # s3 AWS_ACCESS_KEY_ID = str(os.getenv("AWS_ACCESS_KEY_ID")) AWS_SECRET_ACCESS_KEY = str(os.getenv("AWS_SECRET_ACCESS_KEY")) S3_BUCKET = str(os.getenv("S3_BUCKET")) S3_UPLOAD_DIRECTORY = str(os.getenv("S3_UPLOAD_DIRECTORY"))
Now I have two different result sets. It extracts from environment variables . One, when my application is on my local computer and from Heroku configuration variables during production. For instance.
DEBUG = str(os.getenv("DEBUG"))
is "TRUE" on my local computer. But a lie on Hereka. To check Heroku configuration configuration.
Heroku config
Also keep in mind that if you want some files to be part of your project locally, but not to the hero or github, you can use git ignore . Of course, these files will not exist in your working application.
source share