From 00461080f2c3bb9372c2ec28c2f40e0f64397077 Mon Sep 17 00:00:00 2001 From: chzhang Date: Sat, 3 Dec 2022 21:12:15 +0800 Subject: template htmls --- web/flask_proj/tut02/main.py | 21 ++++++++++++ web/flask_proj/tut02/templates/base.html | 54 +++++++++++++++++++++++++++++++ web/flask_proj/tut02/templates/index.html | 11 +++++++ web/flask_proj/tut02/templates/login.html | 15 +++++++++ 4 files changed, 101 insertions(+) create mode 100644 web/flask_proj/tut02/main.py create mode 100644 web/flask_proj/tut02/templates/base.html create mode 100644 web/flask_proj/tut02/templates/index.html create mode 100644 web/flask_proj/tut02/templates/login.html (limited to 'web/flask_proj/tut02') diff --git a/web/flask_proj/tut02/main.py b/web/flask_proj/tut02/main.py new file mode 100644 index 0000000..0a24e16 --- /dev/null +++ b/web/flask_proj/tut02/main.py @@ -0,0 +1,21 @@ + +from flask import Flask, render_template + + +app = Flask(__name__) + + +@app.route('/') +def home(): + # return 'hello flask!' + return render_template('index.html') + + +@app.route('/login') +def login(): + # return 'hello flask!' + return render_template('login.html') + + +if __name__ == '__main__': + app.run(debug=True) diff --git a/web/flask_proj/tut02/templates/base.html b/web/flask_proj/tut02/templates/base.html new file mode 100644 index 0000000..83e403f --- /dev/null +++ b/web/flask_proj/tut02/templates/base.html @@ -0,0 +1,54 @@ + + + + + + {% block title %} {% endblock %} + + + + + + {% block content %} {% endblock %} + + + + + + + \ No newline at end of file diff --git a/web/flask_proj/tut02/templates/index.html b/web/flask_proj/tut02/templates/index.html new file mode 100644 index 0000000..961ff77 --- /dev/null +++ b/web/flask_proj/tut02/templates/index.html @@ -0,0 +1,11 @@ + +{% extends "base.html" %} + +{% block title %} +index page +{% endblock %} + + +{% block content %} +

Hello Flask Jinja

+{% endblock %} \ No newline at end of file diff --git a/web/flask_proj/tut02/templates/login.html b/web/flask_proj/tut02/templates/login.html new file mode 100644 index 0000000..957141d --- /dev/null +++ b/web/flask_proj/tut02/templates/login.html @@ -0,0 +1,15 @@ + +{% extends "base.html" %} + +{% block title %} +login page +{% endblock %} + + +{% block content %} +

Login

+
+

+

+
+{% endblock %} -- cgit v1.2.3