From 047f72a4902ea70d53ba63798c890de61b72afc0 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 7 Feb 2025 16:13:29 +0100 Subject: [PATCH] feat: add tailwindcss with a basic file reader --- flaskex/app.py | 26 ++-- flaskex/templates/base.jinja | 231 +++++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+), 12 deletions(-) create mode 100644 flaskex/templates/base.jinja diff --git a/flaskex/app.py b/flaskex/app.py index e3340cf..a1b3ae9 100644 --- a/flaskex/app.py +++ b/flaskex/app.py @@ -1,47 +1,49 @@ +from pathlib import Path + from flask import Flask, url_for from markupsafe import escape app = Flask(__name__) +TEMPLATES_DIR = Path("./flaskex/templates/") + + @app.route("/") def index(): - return f""" - - Deine Mama - - - -

Hello, World!

- blabla - blabla id - - """ + f = open(TEMPLATES_DIR / "base.jinja") + raw = f.read() + return raw + @app.route('/user/') def user_profile(username): # show the user profile for that user return f'User {escape(username)}' + @app.route('/user/by_uuid/') def user_id(user_id): # show the user profile for that user return f'Your mom has this id: {escape(user_id)}' + @app.route('/post/') def post_show(post_id): # show the post with the given id, the id is an integer return f'Post {post_id}' + @app.route('/path/') def subpath_show(subpath): # show the subpath after /path/ return f'Subpath {escape(subpath)}' + with app.test_request_context(): print("{:=^80}".format("URIs")) print(url_for('index')) print(url_for('user_profile', username="yo mama")) - print(url_for('user_id' ,user_id="blabla")) + print(url_for('user_id', user_id="blabla")) print(url_for('post_show', post_id=1337)) print(url_for('subpath_show', subpath="blablabla")) print(url_for('static', filename='style.css')) diff --git a/flaskex/templates/base.jinja b/flaskex/templates/base.jinja new file mode 100644 index 0000000..2819214 --- /dev/null +++ b/flaskex/templates/base.jinja @@ -0,0 +1,231 @@ + + + + + + + Deine Mama + + + + + + + +
+ + +
+
+

Dashboard

+
+
+
+
+
+ + + +
+
+

Work with us

+

Anim aute id + magna aliqua ad ad non deserunt sunt. Qui irure qui lorem cupidatat commodo. Elit sunt + amet fugiat veniam occaecat fugiat.

+
+
+ +
+
+
Offices worldwide
+
12
+
+
+
Full-time colleagues
+
300+
+
+
+
Hours per week
+
40
+
+
+
Paid time off
+
Unlimited
+
+
+
+
+
+ +
+
+
+ + + +