mirror of
https://github.com/PotentiaRobotics/sample-flaskServer.git
synced 2025-04-09 22:20:16 -04:00
Flask server
This commit is contained in:
parent
504645f3b5
commit
145f20c127
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
|
.webassets-cache/
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
19
app.py
Normal file
19
app.py
Normal file
|
@ -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)
|
3
static/src/style.css
Normal file
3
static/src/style.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
h1 {
|
||||||
|
color: blue;
|
||||||
|
}
|
16
templates/index.html
Normal file
16
templates/index.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
{% assets 'css' %}
|
||||||
|
<link rel="stylesheet" href="{{ ASSET_URL }}" />
|
||||||
|
{% endassets %}
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>html text</h1>
|
||||||
|
<h1>{{ text }}</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user