Skip to content

FLASK_DEBUG env variable no longer works as of click 8.4.0 #6025

@crono782

Description

@crono782

Description of bug:

FLASK_DEBUG=1 was working previously to set flask's debug mode either in a .env/.flaskenv and using python-dotenv OR by manually setting with export FLASK_DEBUG=1. As of today, setting it by env variable no longer works. Flask will still use debug mode using the --debug flag. Downgrading click to 8.3.3 resolves the issue.

Replicate bug:

python3 -m venv venv
. venv/bin/activate
pip install flask
cat << EOF > app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
    return 'hello world'
EOF
export FLASK_DEBUG=1
flask run

This produces:

Debug mode: off

pip install click==8.3.3
flask run

Then produces:

Debug mode: on

Environment:

  • Python version: 3.12.3
  • Flask version: 3.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions