* rename main to app
* add index route * add index template * add css stylesheet * add config file
This commit is contained in:
parent
23dfa24cdb
commit
b5c206a37c
6 changed files with 64 additions and 0 deletions
0
main.py
0
main.py
18
src/app.py
Normal file
18
src/app.py
Normal 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
2
src/config.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
class Config:
|
||||
name = "Sand"
|
7
src/public/styles/style.css
Normal file
7
src/public/styles/style.css
Normal file
|
@ -0,0 +1,7 @@
|
|||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header>.text-title {
|
||||
font-size: 2.5rem;
|
||||
}
|
9
src/routes/index.py
Normal file
9
src/routes/index.py
Normal 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
28
src/templates/index.html
Normal 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>
|
Reference in a new issue