Posts

Showing posts from March, 2018

Run Flask with Debug in PyCharm

Image
I have gotten to setting UP a Flask environment for a project recently. Was completely puzzled by how to run this. I have used to running Django project with python manage.py script. This means pointing out a PyCharm interpreter into a certain point of entry, that is also a .py file also.

In flask way of starting things there is another approach however. Here it is in Flask Docs.
It states to set a variable FLASK_APP and then run a flask run command. This will confuse running a python script way of a project being run. Thus to fix this one needs to set a path to flask binary file. It usually is within a virtual environment binary directory, place where your python interpreter resides.

So to set debugging one needs to set path to script binary one needs:
Script: /path/to/env/bin/flaskScript parameters: runEnvironment variable FLASK_APP=app.pyEnvironment variable FLASK_DEBUG=TrueSet working directory back to your app path (It changes automatically according to script being set) So my wil…