Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong default value for FLASK_ENV #4740

Closed
studer-l opened this issue Aug 4, 2022 · 1 comment · Fixed by #4742
Closed

Wrong default value for FLASK_ENV #4740

studer-l opened this issue Aug 4, 2022 · 1 comment · Fixed by #4742
Milestone

Comments

@studer-l
Copy link

studer-l commented Aug 4, 2022

Previously, if FLASK_ENV was not set, it would default to "production", now it defaults to "development".

Reproduction:

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello_world():
    print(f"{app.config.get('ENV')=}")
    return "<p>Hello, World!</p>"

Run using gunicorn, gunicorn flask_demo.app:app with FLASK_ENV unset,

Flask 2.2.1, this handler prints:
app.config.get('ENV')='development'

downgrade to 2.1.0:
app.config.get('ENV')='production'

I assume this due to #4720, src/flask/app.py:693

Environment:

  • Python version: 3.10.4
  • Flask version: 2.2.1
studer-l pushed a commit to studer-l/flask that referenced this issue Aug 4, 2022
@davidism davidism added this to the 2.2.2 milestone Aug 4, 2022
@davidism davidism linked a pull request Aug 4, 2022 that will close this issue
@davidism
Copy link
Member

davidism commented Aug 4, 2022

Note that this only affects the value of app.env, not FLASK_ENV. Both are deprecated. app.env has no effect on Flask itself anymore. Only FLASK_ENV=development will switch to debug mode.

@davidism davidism closed this as completed Aug 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants