Basic architecture
This commit is contained in:
1 parent
f787232548
commit
ad1dcfb1d7
7 files changed
+66
No files matched your search
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
class Config:
|
||||
DEBUG = True
|
||||
SECRET_KEY = "jaimelespainsauchocolat"
|
||||
@@ -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")
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}SnowField{% endblock %}</title>
|
||||
|
||||
<!-- Exemple CSS -->
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<main>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>© 2026 SnowField</p>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Accueil - SnowField{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Bienvenue sur SnowField</h2>
|
||||
<p>Ceci est la page d'accueil.</p>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,6 @@
|
||||
from app import create_app
|
||||
|
||||
app = create_app()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=True)
|
||||
Reference in new issue
Block a user