Utilities for creating a 12 factor application, at present it allows you to parse the processes environment variables into a configuration dictionary.
For more information check the Documentation.
Install using poetry
poetry add twelvefactorInstall using pipenv
pip install twelvefactorInstall using pip
pip install twelvefactorimport flask
import twelvefactor
SCHEMA = {
'DEBUG': {
'type': bool,
'default': False,
},
'SECRET_KEY': str,
}
app = flask.Flask()
app.config.update(twelvefactor.config(SCHEMA))# settings.py
import dj_database_url
import twelvefactor
SCHEMA = {
"DEBUG": {"type": bool, "default": False},
"SECRET_KEY": str,
"DATABASES": {
"key": "DATABASE_URL",
"default": "sqlite:///",
"mapper": lambda v: {"default": dj_database_url.parse(v)},
},
}
globals().update(twelvefactor.config(SCHEMA))To install from source:
pip install poetry
git clone git://github.com/artisanofcode/python-twelvefactor.git
cd python-twelvefactor
poetry developUpdate CHANGES and then run the following
poetry version patch
git commit -am 'bumped the version'
git tag v${VERSION}
poetry version prerelease
git commit -am 'prerelease version'
git push --tagsSee CHANGES
This project is licensed under the MIT licence.
This project uses Semantic Versioning.