https://flask.palletsprojects.com/en/1.1.x/
$ mkdir flask-tutorial
$ cd flask-tutorial
Create an environment
$ python3 -m venv venv
Activate the environment
$ . venv/bin/activate
Install Flask
$ pip install Flask
hello.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, World!'
파이썬 프로젝트는 패키지 를 사용 하여 코드를 여러 모듈로 구성하여 필요한 곳에서 가져올 수 있으며 튜토리얼도이 작업을 수행합니다.
flask-tutorial
├── flaskr/
│ ├── __init__.py
│ ├── db.py
│ ├── schema.sql
│ ├── auth.py
│ ├── blog.py
│ ├── templates/
│ │ ├── base.html
│ │ ├── auth/
│ │ │ ├── login.html
│ │ │ └── register.html
│ │ └── blog/
│ │ ├── create.html
│ │ ├── index.html
│ │ └── update.html
│ └── static/
│ └── style.css
├── tests/
│ ├── conftest.py
│ ├── data.sql
│ ├── test_factory.py
│ ├── test_db.py
│ ├── test_auth.py
│ └── test_blog.py
├── venv/
├── setup.py
└── MANIFEST.in
.gitignore
venv/
*.pyc
__pycache__/
instance/
.pytest_cache/
.coverage
htmlcov/
dist/
build/
*.egg-info/