Browse Source

made first minimal flask

master
nglk 4 years ago
parent
commit
b3a2a725b8
  1. BIN
      __pycache__/hello.cpython-36.pyc
  2. 14
      hello.py
  3. 0
      index.html
  4. 7
      templates/hello.html

BIN
__pycache__/hello.cpython-36.pyc

Binary file not shown.

14
hello.py

@ -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)

0
index.html

7
templates/hello.html

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