added info about configuring the app

This commit is contained in:
eclipse 2025-07-16 17:48:37 +02:00
parent 6f3e53273d
commit 1111a35f3d

View File

@ -1,8 +1,19 @@
# The Works # 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 ## Flask commands
Execute commands with `python -m flask --app the_works <command>` Execute commands with `python -m flask <command>`. 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: Available commands:
@ -12,6 +23,8 @@ Available commands:
* *
## Dependencies ## Dependencies
### Python Packages ### Python Packages