Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
352 lines (233 sloc) 10.2 KB


This part of the documentation covers all the interfaces of Flask. For parts where Flask depends on external libraries, we document the most important right here and provide links to the canonical documentation.

Application Object

Module Objects

Incoming Request Data

To access incoming request data, you can use the global request object. Flask parses incoming request data for you and gives you access to it through that global object. Internally Flask makes sure that you always get the correct data for the active thread if you are in a multithreaded environment.

The request object is an instance of a :class:`~werkzeug.Request` subclass and provides all of the attributes Werkzeug defines. This just shows a quick overview of the most important ones.

Response Objects


If you have the :attr:`Flask.secret_key` set you can use sessions in Flask applications. A session basically makes it possible to remember information from one request to another. The way Flask does this is by using a signed cookie. So the user can look at the session contents, but not modify it unless he knows the secret key, so make sure to set that to something complex and unguessable.

To access the current session you can use the :class:`session` object:

The session object works pretty much like an ordinary dict, with the difference that it keeps track on modifications.

The following attributes are interesting:

Application Globals

To share data that is valid for one request only from one function to another, a global variable is not good enough because it would break in threaded environments. Flask provides you with a special object that ensures it is only valid for the active request and that will return different values for each request. In a nutshell: it does the right thing, like it does for :class:`request` and :class:`session`.

Useful Functions and Classes

Message Flashing

Returning JSON

Template Rendering


Useful Internals

Jump to Line
Something went wrong with that request. Please try again.