I am a passionate full-stack web developer with 16 years of hands-on and management experience. I love helping startups owners and small teams turn their ideas into products.
Having a config.py doesn't mean that I don't use environment variables or initialize configuration from secrets. Instead, config provides an abstraction layer that hides the configuration source.
My current preferred setup consists of three files at the top of the project.
config.py: acts mainly as a proxy to environment variables.
services.py: a service registry that other parts of the code use heavily.
app.py: the module with a function initializing the project.
In the app.py, I wrap initialization with a function to avoid accidental initialization on import.
Environment variables are the way to go 🚀!
Having a config.py doesn't mean that I don't use environment variables or initialize configuration from secrets. Instead, config provides an abstraction layer that hides the configuration source.
My current preferred setup consists of three files at the top of the project.
config.py
: acts mainly as a proxy to environment variables.services.py
: a service registry that other parts of the code use heavily.app.py
: the module with a function initializing the project.In the app.py, I wrap initialization with a function to avoid accidental initialization on import.
Here's my boilerplate.
imankulov / flask-boilerplate
Flask project boilerplate