I have a number of sites that I may be working on simultaneously, and to facilitate this I've arbitrarily designated a particular port that I run each site on in development, rather than running on the default port. I used to do this by having each project specify a hardcoded port when it called app.run:
app.run(debug=True, port=8050)
With Flask 0.12, the recommended way to run Flask is using the flask run command, which seems like a good change overall. In each application's virtualenv setup, I can set the FLASK_APP and FLASK_DEBUG environment variables so that I don't have to set them manually every time I start up the development server. However, there is no environment variable or anything of the sort to set the port, so every time I run an application, I still need to manually specify the appropriate port each time - flask run --port 8050 instead of just flask run.
In #2113 joelhed wanted to use the port in the SERVER_NAME config variable, and the issue was closed on the basis that it's technically infeasible to load app config before starting up the server, which makes sense. However, a FLASK_PORT environment variable would presumably not have this problem, and it would reduce friction significantly both for people like me and joelhed (and anyone else who for any reason can't run all their Flask applications on port 5000). Is there any chance for this to be added? I can make a pull request for this if necessary.
Click already sets options using env vars: export FLASK_RUN_PORT=8050
Turns out this wasn't documented, I thought it was. See #2713.
Most helpful comment
Click already sets options using env vars:
export FLASK_RUN_PORT=8050