https://flask.palletsprojects.com/en/2.0.x/quickstart/
설치
pip install Flask
e.g.) hello.py
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
설명
from flask import Flask
- Flask 를 import
app = Flask(__name__)
- Flask 인스턴스 생성
@app.route("/")
- route 설정
- "/" 은 root 경로
실행
$ export FLASK_APP=hello
$ flask run
* Running on http://127.0.0.1:5000/
댓글 없음:
댓글 쓰기