====== Organiser l'application grâce aux Blueprints ======
Tutorial : [[https://www.youtube.com/watch?v=wC3qkE5vD4M]]
/home/marc/flaskapp
├── app
│ ├── section1
│ │ ├── __init__.py
│ │ └── ...
│ │
│ ├── section2
│ │ ├── __init__.py
│ │ └── ...
│ │
│ ├── templates
│ │ ├── section1
│ │ │ ├── home.html
│ │ │ └── ...
│ │ │
│ │ ├── section2
│ │ │ ├── home.html
│ │ │ └── ...
│ │ │
│ │ └── base.html
│ │
│ ├── __init__.py
│ ├── ...
│ ├── home.py
│ └── ...
├── run.py
└── ...
===== home =====
from flask import Blueprint, render_template
home = Blueprint("home", __name__)
@home.route("/home")
def home_page():
return render_template("index.html")
===== __init__.py =====
from flask import Flask
from app.home import home
app = Flask(__name__)
app.register_blueprint(home)
===== run.py =====
from app import app
app.run(host="0.0.0.0", port=8000, debug=True)