From ff4b5da2e77c6fcf4c02e6579a0782f9d22b9587 Mon Sep 17 00:00:00 2001 From: Miles Winther Date: Mon, 29 Jan 2024 16:42:26 +0100 Subject: [PATCH] Add doc for local config with .env --- CONTRIBUTING.md | 18 ++++++++++++++++++ src/datadoc/app.py | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa2f41ce..b5565e47 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,6 +77,24 @@ poetry run python poetry run datadoc ``` +## Config for local development + +We use a python package called `python-dotenv` for configuration management. This gives two possibilities for sourcing configuration: + +1. Environment variables. +1. A file called `.env` by convention. + +To set up for local development run this command from the root of the repo. + +1. Create a file `src/datadoc/.env` +1. Place the following lines in the file: +``` +DATADOC_DASH_DEVELOPMENT_MODE=True +DATADOC_LOG_LEVEL=debug +``` + +To see all configuration options, see `src/datadoc/config.py` + ## How to test the project Run the full test suite: diff --git a/src/datadoc/app.py b/src/datadoc/app.py index ccf836b9..7e898895 100644 --- a/src/datadoc/app.py +++ b/src/datadoc/app.py @@ -118,7 +118,9 @@ def main(dataset_path: str | None = None) -> None: port=port, ) else: - app.run(debug=config.get_dash_development_mode(), port=port) + if dev_mode := config.get_dash_development_mode(): + logger.warning("Starting in Development Mode. NOT SUITABLE FOR PRODUCTION.") + app.run(debug=dev_mode, port=port) if __name__ == "__main__":