November 2014
Intermediate to advanced
258 pages
5h 15m
English
This is the simplest way of writing views and URL routes in Flask. We can just write a method and decorate it with the endpoint.
To understand this recipe, we can start with any Flask application. The app can be a new, empty, or any complex app. We just need to understand the methods outlined in this recipe.
The following are the three most widely used, different kinds of requests, demonstrated with short examples.
Consider the following code:
@app.route('/a-get-request')
def get_request():
bar = request.args.get('foo', 'bar')
return 'A simple Flask request where foo is %s' % barThis is a simple example of what a GET request looks like. Here, we just check whether ...
Read now
Unlock full access