From ad1dcfb1d7cb43a49826e4d7b04b0b36f743b556 Mon Sep 17 00:00:00 2001 From: so-boring-robot Date: Thu, 8 Oct 2026 16:17:17 +0200 Subject: [PATCH] Basic architecture --- app/__init__.py | 16 ++++++++++++++++ app/config.py | 3 +++ app/routes/main.py | 7 +++++++ app/templates/base.html | 23 +++++++++++++++++++++++ app/templates/index.html | 8 ++++++++ run.py | 6 ++++++ wsgi.py | 3 +++ 7 files changed, 66 insertions(+) create mode 100644 app/__init__.py create mode 100644 app/config.py create mode 100644 app/routes/main.py create mode 100644 app/templates/base.html create mode 100644 app/templates/index.html create mode 100644 run.py create mode 100644 wsgi.py diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..bae06e6 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,16 @@ +from flask import Flask +from .routes.main import main_bp + +def create_app(): + app = Flask(__name__, instance_relative_config=True) + + # Charge la config par défaut + app.config.from_object("app.config.Config") + + # Charge la config sensible (instance/config.py) + app.config.from_pyfile("config.py", silent=True) + + # Enregistre les blueprints + app.register_blueprint(main_bp) + + return app diff --git a/app/config.py b/app/config.py new file mode 100644 index 0000000..e15ac84 --- /dev/null +++ b/app/config.py @@ -0,0 +1,3 @@ +class Config: + DEBUG = True + SECRET_KEY = "jaimelespainsauchocolat" diff --git a/app/routes/main.py b/app/routes/main.py new file mode 100644 index 0000000..f7f72ae --- /dev/null +++ b/app/routes/main.py @@ -0,0 +1,7 @@ +from flask import Blueprint, render_template + +main_bp = Blueprint("main", __name__) + +@main_bp.route("/") +def index(): + return render_template("index.html", title="SnowField") diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000..ea98f5d --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,23 @@ + + + + + {% block title %}SnowField{% endblock %} + + + + + + + +
+ {% block content %} + {% endblock %} +
+ + + + + diff --git a/app/templates/index.html b/app/templates/index.html new file mode 100644 index 0000000..df302bf --- /dev/null +++ b/app/templates/index.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} + +{% block title %}Accueil - SnowField{% endblock %} + +{% block content %} +

Bienvenue sur SnowField

+

Ceci est la page d'accueil.

+{% endblock %} diff --git a/run.py b/run.py new file mode 100644 index 0000000..488dae9 --- /dev/null +++ b/run.py @@ -0,0 +1,6 @@ +from app import create_app + +app = create_app() + +if __name__ == "__main__": + app.run(debug=True) diff --git a/wsgi.py b/wsgi.py new file mode 100644 index 0000000..0a23b5a --- /dev/null +++ b/wsgi.py @@ -0,0 +1,3 @@ +from app import create_app + +app = create_app()