본문 바로가기
DevTools

[PyCharm] Run Flask Application on PyCharm

by llHoYall 2021. 1. 26.

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...".

  1. Put the name that you want.
  2. Click the folder icon and select the Script path of Flask.
  3. Put the "run" as a parameter.
  4. 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.

댓글