From 145f20c12727fba6f2a76ca8e88382de6f26402f Mon Sep 17 00:00:00 2001 From: FluffyCube9343 Date: Thu, 12 Jan 2023 21:42:22 -0500 Subject: [PATCH] Flask server --- .gitignore | 2 ++ app.py | 19 +++++++++++++++++++ static/src/style.css | 3 +++ templates/index.html | 16 ++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 app.py create mode 100644 static/src/style.css create mode 100644 templates/index.html diff --git a/.gitignore b/.gitignore index b6e4761..93e5ecb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.webassets-cache/ + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/app.py b/app.py new file mode 100644 index 0000000..322e16c --- /dev/null +++ b/app.py @@ -0,0 +1,19 @@ +from flask import Flask, render_template, request, jsonify +from flask_assets import Bundle, Environment +import random +app = Flask(__name__) + +assets = Environment(app) +css = Bundle("src/style.css", output="dist/main.css") + +assets.register("css", css) +css.build() + + +@app.route("/") +def homepage(): + return render_template("index.html", text="bye") + + +if __name__ == "__main__": + app.run(debug=True) \ No newline at end of file diff --git a/static/src/style.css b/static/src/style.css new file mode 100644 index 0000000..03d0aca --- /dev/null +++ b/static/src/style.css @@ -0,0 +1,3 @@ +h1 { + color: blue; +} diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..444b5e4 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,16 @@ + + + + + + + {% assets 'css' %} + + {% endassets %} + Document + + +

html text

+

{{ text }}

+ +