4

I've setup a logger with Flask but it doesn't print to the Pycharm console, thought it might be because of not being in debug mode. app.debug = True but FLASK_DEBUG = 0 when I run the application.

app = Flask(__name__)
app.debug = True
el_pup_le
  • 11,711
  • 26
  • 85
  • 142

4 Answers4

8

you can get it done by visiting the flask edit configuration tab..I have attached the screenshots..please follow it..

visit the flask configuration tab by finding this option in your top right corner

visit the flask configuration tab by finding this option in your top right corner

Here you can enable disable debug option for your flask app

Here you can enable disable debug option for your flask app

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Karthikeyan K
  • 229
  • 2
  • 7
5

Make sure you've acquired the environment variable FLASK_DEBUG in your running environment.

on Unix $ export FLASK_DEBUG=1

on Windows set FLASK_DEBUG=1

Also app.run(debug=False, threaded=True) worked in Python2.6 ... worth a shot.

This also causes your app to restart when changes are detected in the application's source file.

Mostly_Yoshi
  • 93
  • 10
0

If you are in windows, just use the following code to set flask_debug:

import os
os.environ["FLASK_DEBUG"] = "1"
Mingut
  • 71
  • 6
-1

Try this settings from official guide https://flask.palletsprojects.com/en/2.2.x/cli/#pycharm-integration

enter image description here

or this answer https://stackoverflow.com/a/73427798/17176270

enter image description here

Vitalii Mytenko
  • 544
  • 5
  • 20