From b5c206a37c7b7a968bfa2e6a945410c704b9f994 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 26 Sep 2022 12:37:07 +0200 Subject: [PATCH] * rename main to app * add index route * add index template * add css stylesheet * add config file --- main.py | 0 src/app.py | 18 ++++++++++++++++++ src/config.py | 2 ++ src/public/styles/style.css | 7 +++++++ src/routes/index.py | 9 +++++++++ src/templates/index.html | 28 ++++++++++++++++++++++++++++ 6 files changed, 64 insertions(+) delete mode 100644 main.py create mode 100644 src/app.py create mode 100644 src/config.py create mode 100644 src/public/styles/style.css create mode 100644 src/routes/index.py create mode 100644 src/templates/index.html diff --git a/main.py b/main.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/app.py b/src/app.py new file mode 100644 index 0000000..979797f --- /dev/null +++ b/src/app.py @@ -0,0 +1,18 @@ +from routes.index import router as index +from flask import Flask, redirect + + +app = Flask(__name__, static_url_path="/", static_folder="public") +app.register_blueprint(index, url_prefix="/index") + + +@app.route('/') +def root(): + return redirect("index") + + +class AttributeDict(dict): + def __getattr__(self, name): + if name in self: + return self[name] + raise AttributeError(name) diff --git a/src/config.py b/src/config.py new file mode 100644 index 0000000..483808c --- /dev/null +++ b/src/config.py @@ -0,0 +1,2 @@ +class Config: + name = "Sand" diff --git a/src/public/styles/style.css b/src/public/styles/style.css new file mode 100644 index 0000000..a681ac1 --- /dev/null +++ b/src/public/styles/style.css @@ -0,0 +1,7 @@ +.text-center { + text-align: center; +} + +header>.text-title { + font-size: 2.5rem; +} diff --git a/src/routes/index.py b/src/routes/index.py new file mode 100644 index 0000000..9581268 --- /dev/null +++ b/src/routes/index.py @@ -0,0 +1,9 @@ +from flask import Blueprint, render_template +from config import Config + +router = Blueprint("index", __name__) + + +@router.route("/") +def index(): + return render_template("index.html", name=Config.name) diff --git a/src/templates/index.html b/src/templates/index.html new file mode 100644 index 0000000..3e1cbc2 --- /dev/null +++ b/src/templates/index.html @@ -0,0 +1,28 @@ + + + + + + + + {{ name }} - Index + + + + + +
+

Sand

+ +
+ +
+

placeholder-main

+
+ + + + +