Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Flask Tutorial

Flask Tutorial

Flask is a lightweight Web application framework written in Python.

Flask is based on WSGI (Web Server Gateway Interface) and the Jinja2 template engine, and aims to help developers create Web applications quickly and easily.

Flask lets us quickly write websites, APIs, and backend services in Python.

Flask is suitable for small projects, API endpoints, and microservices.


Who should read this tutorial?

This tutorial is suitable for developers with a Python foundation.


What you need to know before studying this tutorial

Before learning this tutorial, you need to understand some basic web knowledge and Python 3.x Basic Tutorial。


The first Flask program

The following Flask program outputs Hello World on a web page:

Example

from

flask

import

Flask

app

=

Flask

(

name

)

@

app.

route

(

"/"

)

def

hello

(

)

:

   

return

"Hello World!"

if

name

==

"main"

:

    app.

run

(

)


Reference Documentation