Right now, app/__init.py__ reads from config.py which defines few constant variables and also loads few from database.yml and application.yml. Would be nice to just have one place (or at least one file for all variables that are secret or not constant) to look at for all the application variables.
After some reading, I suggest, we use an approach similar to the one discussed in the Flask guides: http://exploreflask.com/en/latest/configuration.html#configuring-based-on-environment-variables
-
We will make environment specific configuration files under config/ directory.
config/
__init__.py # Empty, just here to tell Python that it's a package.
default.py
production.py
development.py
-
config/default.py will be checked in into the source code. So define secrets as empty strings.
-
we will load the configuration in app/__init__.py depending on the environment the app is running in or just load the default.
-
config/production.py and config/development.py will not be checked in into the source control.
Reference:
Right now,
app/__init.py__reads fromconfig.pywhich defines few constant variables and also loads few fromdatabase.ymlandapplication.yml. Would be nice to just have one place (or at least one file for all variables that are secret or not constant) to look at for all the application variables.After some reading, I suggest, we use an approach similar to the one discussed in the Flask guides: http://exploreflask.com/en/latest/configuration.html#configuring-based-on-environment-variables
We will make environment specific configuration files under
config/directory.config/default.pywill be checked in into the source code. So define secrets as empty strings.we will load the configuration in
app/__init__.pydepending on the environment the app is running in or just load the default.config/production.pyandconfig/development.pywill not be checked in into the source control.Reference: