Skip to Content
Mastering Flask
book

Mastering Flask

by Jack Stouffer
September 2015
Intermediate to advanced
288 pages
5h 30m
English
Packt Publishing
Content preview from Mastering Flask

Modifying the response with Flask extensions

So, we have created an extension that adds new functionality to our templates. But how would we create an extension which modifies the behavior of our app at the request level? To demonstrate this, let's create an extension that modifies all the responses from Flask by compressing the contents of the response. This is a common practice in web development in order to speed up page load times, as compressing objects with a method like gzip is very fast and relatively cheap CPU-wise. Normally, this would be handled at the server level. So, unless you wish to host your app with only Python code, which is possible and will be covered in Chapter 13, Deploying Flask Apps, this extension really doesn't have ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

An Introduction to Flask

An Introduction to Flask

Miguel Grinberg
Flask Blueprints

Flask Blueprints

Joel Perras
Flask By Example

Flask By Example

Gareth Dwyer

Publisher Resources

ISBN: 9781784393656Supplemental Content