Bird
0
0

You added Flask-Compress to your Flask app but notice responses are not compressed. Which of these is the most likely cause?

medium📝 Debug Q14 of 15
Flask - Middleware and Extensions
You added Flask-Compress to your Flask app but notice responses are not compressed. Which of these is the most likely cause?
AYou forgot to call <code>Compress(app)</code> after creating the Flask app
BYou used <code>Compress()</code> without passing the app instance
CThe client does not send <code>Accept-Encoding</code> header
DAll of the above
Step-by-Step Solution
Solution:
  1. Step 1: Check Flask-Compress initialization

    If you don't call Compress(app) or call Compress() without app, compression won't activate.
  2. Step 2: Consider client headers

    Compression only happens if the client sends Accept-Encoding header indicating support.
  3. Step 3: Combine causes

    All these issues can cause no compression, so the correct answer is all of the above.
  4. Final Answer:

    All of the above -> Option D
  5. Quick Check:

    Initialization and client headers both matter = D [OK]
Quick Trick: Check app init and client headers for compression issues [OK]
Common Mistakes:
MISTAKES
  • Ignoring client headers
  • Not calling Compress(app)
  • Assuming compression works without setup

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes