How it works...

Flask is intelligent enough to pick up only configuration variables that are written in uppercase. This allows us to define any local variables in our configuration files and objects and leave the rest to Flask.

The best practice when using configurations is to have a bunch of default settings in app.py, or via any object in the application itself, and to then override the same by loading it from the configuration file. So, the code will look as follows:

app = Flask(__name__) 
DEBUG = True 
TESTING = True 
app.config.from_object(__name__) 
app.config.from_pyfile('/path/to/config/file')