0% found this document useful (0 votes)
105 views36 pages

Flask Web App Development Guide

The document contains various code snippets and URLs related to web development using Flask, including routing and rendering templates. It also includes HTTP request examples and a JSON array of data about different versions of 'The Office' series. Overall, it serves as a reference for building web applications and handling data in Python.

Uploaded by

inezaodon1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views36 pages

Flask Web App Development Guide

The document contains various code snippets and URLs related to web development using Flask, including routing and rendering templates. It also includes HTTP request examples and a JSON array of data about different versions of 'The Office' series. Overall, it serves as a reference for building web applications and handling data in Python.

Uploaded by

inezaodon1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

http-server

[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
[Link]
GET /search?q=cats HTTP/2
Host: [Link]
...
Flask
flask run
[Link]
[Link]
from flask import Flask

app = Flask(__name__)

@[Link]("/")
def index():
return "hello, world"
[Link]
[Link]
static/
templates/
from flask import Flask, render_template

app = Flask(__name__)

@[Link]("/")
def index():
return render_template("[Link]")
[Link]
Jinja
[Link]
[Link]/templates/
Controller View
Model Controller View
POST / HTTP/2
Host: [Link]

...
HTTP/2 200
Content-Type: text/html

...
HTTP/2 200
Content-Type: text/html
Set-Cookie: session=value
...
GET / HTTP/2
Host: [Link]

...
GET / HTTP/2
Host: [Link]
Cookie: session=value
...
session
from cs50 import SQL
API
JSON
[
{"id": 112108, "title": "The Office", "year": 1995, "episodes": 6},
{"id": 290978, "title": "The Office", "year": 2001, "episodes": 14},
{"id": 386676, "title": "The Office", "year": 2005, "episodes": 188},
{"id": 1791001, "title": "The Office", "year": 2010, "episodes": 30},
{"id": 2186395, "title": "The Office", "year": 2012, "episodes": 8},
{"id": 8305218, "title": "The Office", "year": 2019, "episodes": 28},
{"id": 20877972, "title": "The Office", "year": 2022, "episodes": 20}
]

You might also like