-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
"flask run" should accept a command line option for FLASK_APP #3095
Description
Currently, flask run can be controlled via one set of environment variables and a different set of command line options. In some cases there is overlap (e.g. FLASK_RUN_PORT and --port), but in other cases there is not.
The most problematic example is the flask app object. The only way to specify this explicitly is via the FLASK_APP environment variable; there is no command line option you can pass flask run to specify this instead.
(This is especially asymmetrical when using Flask with e.g. gunicorn, where the wsgi app must be passed via required positional command line argument.)
Would you accept a patch to allow passing a command line option for FLASK_APP? Being forced to use an environment variable to set this value is less than ideal, as it forces writing this important value out-of-band into a shared mutable global namespace (the environment), rather than being able to pass it directly in-band to flask run.