From 1111a35f3d3e013bfc51af6e4d0c7fdf541a7849 Mon Sep 17 00:00:00 2001 From: eclipse Date: Wed, 16 Jul 2025 17:48:37 +0200 Subject: [PATCH] added info about configuring the app --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d55231..ad25c63 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,19 @@ # The Works +## Configuration + +The file `.flaskenv` contains the default configuration. Flask reads the file at startup and adds the contained key-value-pairs as environment variables to the runtime environment. When the Flask app object is being created in `__init__.py`, all environment variables that start with the prefix "FLASK_" are added to the app configuration. This is true for any prefixed environment variable, not just the ones from `.flaskenv`. + +Configuration values can be overridden by passing another config file to Flask via the `-e` command line switch. It will be processed the same way as `.flaskenv`, which means that all keys must be prefixed with "FLASK_", and takes precedence over the default configuration. + +Finally, you can override config settings while instantiating the Flask app through the factory. To do this, simply pass a dictionary with the (unprefixed) override settings as named parameter `config` to the `create_app()` method. Settings passed this way take precedence over the default configuration and an optional config file. + + + + ## Flask commands -Execute commands with `python -m flask --app the_works ` +Execute commands with `python -m flask `. You don't need to specify `--app the_works` as long as the environment variable "FLASK_APP" is set to "the_works"; the default configuration file does this. Available commands: @@ -12,6 +23,8 @@ Available commands: * + + ## Dependencies ### Python Packages