I have followed the layout of my Flask project from http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world.
I have the following structure:>
After a little bit of fiddling (and a little help from the 'net), I could improve this further, by changing the code to include the config to:
app.config.from_object('config.ProductionConfig')
This enables this cool pattern for configurations:
class Config(object):
DEBUG = True
DEVELOPMENT = True
SECRET_KEY = 'do-i-really-need-this'
FLASK_HTPASSWD_PATH = '/secret/.htpasswd'
FLASK_SECRET = SECRET_KEY
DB_HOST = 'database' # a docker link
class ProductionConfig(Config):
DEVELOPMENT = False
DEBUG = False
DB_HOST = 'my.production.database' # not a docker link
What's left now is to see how to integrate testing configs into this, but at least it feels less clumsy.