: Your logic doesn't need to know where a database is; it just needs the connection string provided by the config.
Flask often uses classes to manage environments. You can create a base config and override it for specific environments. config.py
: By keeping sensitive credentials in a config.py (and adding it to your .gitignore ), you prevent accidentally leaking secrets to public repositories. : Your logic doesn't need to know where
The most straightforward approach is defining variables directly in a .py file and importing them. config.py