Examples of flask apps that have query strings
Clone or download
Latest commit 4df01cc May 12, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples more May 11, 2016
readme_assets/images more pics May 11, 2016
.gitignore first May 11, 2016
README.md first May 11, 2016
lesson-01.md hi May 11, 2016
lesson-02.md more pics May 11, 2016
lesson-03.md more pics May 11, 2016


Flask Apps with Query Strings

A set of lessons and examples in which a __ is presented to the user to allow search/filtering by freeform text, radio buttons, and/or checkboxes.


Code concepts in general

So far in our Flask apps, we've dealt two kinds of simple Flask apps:

Single-page Flask apps

These's apps consist of a single page of data results:

Multi-page Flask apps

Apps that can generate multiple pages based on named route paths and variables:

URL query strings

The iteration here is not too complicated. Instead of generating variable routes like:


We'll be specifying variables in the query string; the below key-value pair is roughly the same effect as the path shown above:


Using query strings allows for greater flexibility in passing variables:


About webforms

How do we pass in those different key-value pairs? In our HTML view, we render a web form that contains input fields for 'state' and 'sort_by' -- or whatever key-value pairs you want.

A web form, in its most basic variation, consists of a <form> tag that:

About the Flask Request object

The Flask documentation has a section on the Request object, which is the data object that the Flask application exposes to a given view function after matching based on an endpoint and query parameters.

For example, if we have an endpoint with a route path of /results and two key-value pairs of:

  • 'id and 42
  • name and mary

The resulting a URL path and query string will be:


The Flask application will serialize the parameters as part of an object named request (which has nothing to do with the Requests library).

Specifically, the request object will have an attribute named args, which is a dictionary of keyvalue pairs, i.e.:

      {'id': '42', 'name': 'mary'}