flask Flashcards

1
Q

import

A

from flask import Flask

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

other imports

A

render_template, request

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

first line of code to start flask app

A

app = Flask(__name__)
where app.py is the app’s name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

function to create & render an html page called index

A

@app.route(“/”)
def index():
return render_template(“index.html”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what are decorators?

A

they define the type of thing the function is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

placeholder for vars

A

{{ var }}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how to get input from the user?

A

forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how to use forms in html

A

<form>
<input></input>
</form>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly