I am working on an app which looks similar to
facebook/
__init__.py
feed/
__init__.py
business.py
vi
You can create a "config" module which contains the configuration for each environment. Thereafter the currently running environment can be specified by setting a shell variable.
If you are initializing your flask application in the main init file, the configuration also could be set there. This is how I set my configuration:
def setup_config(app):
"""Set the appropriate config based on the environment settings"""
settings_map = {'development': DevelopmentSettings,
'staging': StagingSettings,
'testing': TestingSettings,
'production': ProductionSettings}
env = environ['ENV'].lower()
settings = settings_map[env]
app.config.from_object(settings)
Setting up environment variable before running the development server or even the tests can be a hassle, therefore I automate these actions with a makefile.
Also take a look at flask-script http://flask-script.readthedocs.org/en/latest/.