Recall & Review
beginner
What is Flask-Compress used for in a Flask application?
Flask-Compress is used to automatically compress HTTP responses, making data smaller and faster to send to the browser.
Click to reveal answer
beginner
How do you enable Flask-Compress in a Flask app?
You install Flask-Compress, import Compress, then create a Compress object and pass your Flask app to it. This activates compression for responses.Click to reveal answer
intermediate
Which HTTP header does Flask-Compress check to decide if it should compress a response?
Flask-Compress checks the 'Accept-Encoding' header sent by the browser to see if it supports compression like gzip or deflate.
Click to reveal answer
beginner
Name two compression methods Flask-Compress can use.
Flask-Compress can use 'gzip' and 'deflate' compression methods to reduce response size.
Click to reveal answer
intermediate
What types of responses does Flask-Compress compress by default?
By default, Flask-Compress compresses responses with content types like text/html, text/css, application/javascript, application/json, and others that benefit from compression.
Click to reveal answer
What is the main benefit of using Flask-Compress in your Flask app?
✗ Incorrect
Flask-Compress reduces the size of HTTP responses, which helps pages load faster.
Which Python package do you need to install to use Flask-Compress?
✗ Incorrect
The package named 'flask-compress' provides the compression features.
How do you activate Flask-Compress in your Flask app code?
✗ Incorrect
You create a Compress object and pass your Flask app to it like Compress(app).
Which HTTP header must the client send for Flask-Compress to compress the response?
✗ Incorrect
The 'Accept-Encoding' header tells the server which compression methods the client supports.
Which of these content types is commonly compressed by Flask-Compress?
✗ Incorrect
Text-based content like 'text/html' is compressed; images and videos are usually already compressed.
Explain how Flask-Compress improves web app performance and how to set it up in a Flask project.
Think about making pages load faster by sending smaller files.
You got /4 concepts.
Describe what conditions Flask-Compress checks before compressing a response and why this is important.
Consider how the server knows if the browser can handle compressed data.
You got /4 concepts.