From 7838a838cc7c6944577c82269609ca45ecbd35ec Mon Sep 17 00:00:00 2001 From: Sunpy Date: Tue, 12 Feb 2019 17:09:43 +0100 Subject: [PATCH] Template use --- routes.py | 4 ++++ templates/home.html | 4 ++++ templates/layout/main.html | 14 ++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 templates/home.html create mode 100644 templates/layout/main.html diff --git a/routes.py b/routes.py index 976e3ef..75afeb6 100644 --- a/routes.py +++ b/routes.py @@ -1,3 +1,7 @@ from flask import render_template, url_for from objects import glob # Global sharing of python objects in a manageable way +@glob.app.route("/") +@glob.app.route("/home") +def home(): + return render_template("home.html", title = "Home") diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..f7e1afe --- /dev/null +++ b/templates/home.html @@ -0,0 +1,4 @@ +{% extends "layout/main.html" %} +{% block content %} +

Template usage

+{% endblock %} \ No newline at end of file diff --git a/templates/layout/main.html b/templates/layout/main.html new file mode 100644 index 0000000..169a5cb --- /dev/null +++ b/templates/layout/main.html @@ -0,0 +1,14 @@ + + + + +{% if title %} + Husstanden - {{ title }} +{% else %} + Husstanden +{% endif %} + + +{% block content %}{% endblock %} + + \ No newline at end of file