DevTools
[PyCharm] Run Flask Application on PyCharm
llHoYall
2021. 1. 26. 23:13
In this posting, I explain how to run the Flask application on PyCharm.
Installation
On Mac
I used the HomeBrew for installation.
$ brew insstall --cask pycharm-ce
On Windows
I used the Chocolatey for installation.
$ choco install -y pycharm-community
Flask Application
Let's make a very simple application for testing.
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, Flask'
if __name__ == '__main__':
app.run()
It will look like this.

Run Application
In this screen, PyCharm serves the default run configuration for us.
Let's modify this.

Click the "Edit Configurations...".

- Put the name that you want.
- Click the folder icon and select the Script path of Flask.
- Put the "run" as a parameter.
- Click the document icon to set the environment variables.

Add the environment variables refer to the screenshot.
All preparations are done.
Now, click the run button.

It works well !!

Now, enjoy developing the Flask on PyCharm.