代码区项目交易流程

Learning Flask: Part 2: Routes


Learning Flask Installing and Using Routes Templates Errors

Flask is a microframework for server-side web development in python.

Routes

Flask works through reacting to routes. In the terminology of Flask, a route is a URL path defined from the root directory outwards.


Learning Flask: Part 2: Routes

A route is defined through the route() function and a parameter describing the path.

Routes are decorators in Flask. They are associated with other functions that run when the route is detected on the server.

Variable Routes

While absolute URL paths can be defined, variable routes also exist.


Learning Flask: Part 2: Routes

When part of a path is enclosed in less-than and greater-than signs, it becomes a variable for the route. This becomes the name of the parameter passed to the function and thus available within it.

Variable routes can thus be used to handle unexpected and routes that exist to react to internal data or as part of retrieving information from a database.

Play with the example on Repl.it!

本文开发(python)相关术语:python基础教程 python多线程 web开发工程师 软件开发工程师 软件开发流程

点击收藏

LAST Into 2019! Causal logging for distributed scientific computing with Eliot and Dask NEXT