flask Flashcards
1
Q
import
A
from flask import Flask
2
Q
other imports
A
render_template, request
3
Q
first line of code to start flask app
A
app = Flask(__name__)
where app.py is the app’s name
4
Q
function to create & render an html page called index
A
@app.route(“/”)
def index():
return render_template(“index.html”)
5
Q
what are decorators?
A
they define the type of thing the function is
6
Q
create a var called name in the index function & assign it a value
A
name = request.args.get(“name”)
return render_template(“index.html”, name=name)
7
Q
placeholder for vars
A
{{ var }}
8
Q
how to get input from the user?
A
forms
9
Q
how to use forms in html
A
<form>
<input></input>
</form>
10
Q
A