These are environment variables that help Flask understand how to behave.
The first,FLASK_APP
can be left empty and then it will search for "app" or "wsgi" (with or without the ".py" at the end, ie can be a file or a module) but you can also:
- A file/module in the current directory, for example
FLASK_APP=src/hello
;
- A module to be imported, such as
FLASK_APP=hello.web
;
- A specific instance within the module, something like
FLASK_APP=hello:app2
or
- Directly execute the Factory
create_app()
and even with passing parameters, like FLASK_APP=hello:create_app('dev')"
.
These examples I have sinned from flask documentation.
Already the FLASK_ENV
defines the type of execution environment of the project, the values recognized are two, "Production" and "Development", if nothing is defined it will use "Production" by default.
And its function is to turn on/off certain behaviors within Flask and extensions, for example, using "Development" will turn on debug mode ("DEBUG").