FlaskSR provides an easy way to make flask pages load faster and better by streaming HTTP Responses.
Why should you use this?
Every web application tries to minimize the “Time to First Paint”. This can be done by streaming partial responses to client. FlaskSR enables this functionality in an easy way for Flask Web Framework. With FlaskSR you can start streaming partial HTTP responses depending on layout to client so that client starts seeing some content along the way instead of seeing all of the site’s content at once and thus making the pages load faster and better.
- Fully compatible with Jinja templates.
- Minimizes Time for first paint.
- No impact on SEO - as nothing goes via AJAX calls.
- Start rendering important part of your page first so user start seeing important things first.
- Improves perceived performance of the page.
Install the extension with the following command:
pip install flasksr
FlaskSR in action
Once installed, the FlaskSR is easy to use. Let’s walk through setting up a basic application. Also please note that this is a very basic guide: we will be taking shortcuts here that you should never take in a real application.
To begin we’ll set up a Flask app:
You can find examples and sample usage here
Complete documentation for FlaskSR is available on FlaskSR’s GitBook.
We welcome contributions! If you would like to hack on FlaskSR, please follow these steps:
- Fork this repository
- Make your changes
- Submit a pull request after running make check (ensure it does not error!)
- Please give us adequate time to review your submission. Thanks!