I just checked how it is done with popular python projects.
django creates a config file that allows pointing to another config file with database connection details, stored in a different place:
https://docs.djangoproject.com/en/2.0/ref/databases/#connecting-to-the-database
flask and airflow create default configs under user home folder but then allow to use an environment variable to overwrite location of a config file. Config file stores sensitive data such as database connections or secret keys:
http://flask.pocoo.org/docs/0.12/config/#configuring-from-files
https://airflow.apache.org/configuration.html
Both methods allow to:
1) distribute default config file and deploy easily with the package install
2) allow storing sensitive config values in a secured folder
airflow also allows encrypting database connection string using a secret key.
Also refer to this post below and some ideas on how to deploy/store your config file:
https://stackoverflow.com/a/22554594/473725