made first minimal flask

This commit is contained in:
nglk 2020-09-08 16:00:47 +02:00
parent 246ba2f470
commit b3a2a725b8
4 changed files with 21 additions and 0 deletions

Binary file not shown.

14
hello.py Normal file
View File

@ -0,0 +1,14 @@
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
return render_template('hello.html', name=name)

View File

7
templates/hello.html Normal file
View File

@ -0,0 +1,7 @@
<!doctype html>
<title>Hello from Flask</title>
{% if name %}
<h1>Hello {{ name }}!</h1>
{% else %}
<h1>VVVW</h1>
{% endif %}