flask basics

This commit is contained in:
2024-10-10 09:34:33 +02:00
commit 16d07cef98
5 changed files with 903 additions and 0 deletions

22
begin.py Normal file
View File

@ -0,0 +1,22 @@
from flask import Flask, render_template
#This page is based on the following tutorial series:
#https://www.youtube.com/watch?v=0Qxtt4veJIc&list=PLCC34OHNcOtolz2Vd9ZSeSXWc8Bq23yEz
#create a flask instance
app = Flask(__name__)
#create a route decorator
@app.route('/')
#use the route decorator to bind the view function
# def index():
# return "<h1>Hello World</h1>"
def index():
return render_template('index.html')
#localhost:5000/user/John
@app.route('/user/<name>')
def user(name):
return "<h1>Hello {}!!!</h1>".format(name)