made first minimal flask
This commit is contained in:
parent
246ba2f470
commit
b3a2a725b8
BIN
__pycache__/hello.cpython-36.pyc
Normal file
BIN
__pycache__/hello.cpython-36.pyc
Normal file
Binary file not shown.
14
hello.py
Normal file
14
hello.py
Normal 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)
|
7
templates/hello.html
Normal file
7
templates/hello.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!doctype html>
|
||||
<title>Hello from Flask</title>
|
||||
{% if name %}
|
||||
<h1>Hello {{ name }}!</h1>
|
||||
{% else %}
|
||||
<h1>VVVW</h1>
|
||||
{% endif %}
|
Loading…
Reference in New Issue
Block a user