diff options
-rw-r--r-- | app.py | 5 | ||||
-rw-r--r-- | requirements.txt | 2 | ||||
-rw-r--r-- | views/base.html | 13 | ||||
-rw-r--r-- | views/index.html | 7 |
4 files changed, 25 insertions, 2 deletions
@@ -1,9 +1,10 @@ from bottle import Bottle, run +from bottle import jinja2_template as template app = Bottle() [email protected]('/hello') [email protected]("/") 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 %} + |