summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2024-03-20 15:17:36 +0100
committerLinnnus <[email protected]>2024-03-20 15:19:40 +0100
commitdb93ff98409fac1c1a3742d0f81484c985d6d55c (patch)
treea32c8eabb86b10588b6da96d124540f02cec2de1
parent3c1e773f0a91f1a8ef9e637738bb39318ece68f3 (diff)
Add templating engine and index page
-rw-r--r--app.py5
-rw-r--r--requirements.txt2
-rw-r--r--views/base.html13
-rw-r--r--views/index.html7
4 files changed, 25 insertions, 2 deletions
diff --git a/app.py b/app.py
index 20932a8..e8bbc8b 100644
--- a/app.py
+++ b/app.py
@@ -1,9 +1,10 @@
from bottle import Bottle, run
+from bottle import jinja2_template as template
app = Bottle()
def hello():
- return "Hello World!"
+ return template("index")
run(app, host='localhost', port=8080)
diff --git a/requirements.txt b/requirements.txt
index 7a4121d..6f7f942 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1,3 @@
bottle==0.12.25
+Jinja2==3.1.3
+MarkupSafe==2.1.5
diff --git a/views/base.html b/views/base.html
new file mode 100644
index 0000000..9b364a8
--- /dev/null
+++ b/views/base.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ </head>
+ <body>
+ <header>
+ </header>
+ <main>{% block content %}{% endblock %}</main>
+ <footer>
+ </footer>
+ </body>
+</html>
diff --git a/views/index.html b/views/index.html
new file mode 100644
index 0000000..e98e8e5
--- /dev/null
+++ b/views/index.html
@@ -0,0 +1,7 @@
+{% extends "base.html" %}
+
+{% block content %}
+ <h1>Index</h1>
+ <p class="important">Welcome to my awesome homepage.</p>
+{% endblock %}
+