* rename main to app

* add index route
* add index template
* add css stylesheet
* add config file
This commit is contained in:
Mylloon 2022-09-26 12:37:07 +02:00
parent 23dfa24cdb
commit b5c206a37c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
6 changed files with 64 additions and 0 deletions

View file

18
src/app.py Normal file
View file

@ -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)

2
src/config.py Normal file
View file

@ -0,0 +1,2 @@
class Config:
name = "Sand"

View file

@ -0,0 +1,7 @@
.text-center {
text-align: center;
}
header>.text-title {
font-size: 2.5rem;
}

9
src/routes/index.py Normal file
View file

@ -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)

28
src/templates/index.html Normal file
View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ name }} - Index</title>
<link rel="stylesheet" href="../styles/style.css">
</head>
<body>
<header class="text-center">
<h1 class="text-title">Sand</h1>
</header>
<main>
<p>placeholder-main</p>
</main>
<footer>
<p>placeholder-footer</p>
</footer>
</body>
</html>