0
0
Flaskframework~10 mins

Flask-Compress for compression - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Flask-Compress extension.

Flask
from flask_compress import [1]
Drag options to blanks, or click blank then click option'
ACompress
BCompression
Ccompress
DFlaskCompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'compress' instead of 'Compress'.
Using 'FlaskCompress' which does not exist.
2fill in blank
medium

Complete the code to create a Flask app instance.

Flask
app = [1](__name__)
Drag options to blanks, or click blank then click option'
AFlaskCompress
BFlask
CCompress
DApp
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Compress' or 'FlaskCompress' instead of 'Flask'.
Using a lowercase 'flask' which is a module, not a class.
3fill in blank
hard

Fix the error in initializing Flask-Compress with the app.

Flask
compress = Compress()
compress.[1](app)
Drag options to blanks, or click blank then click option'
Ainit_app
Binitialize
Cstart
Dsetup
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'initialize' or 'start' which are not valid methods.
Using 'setup' which is incorrect here.
4fill in blank
hard

Fill both blanks to configure Flask-Compress to compress responses larger than 500 bytes.

Flask
app.config['COMPRESS_MIN_SIZE'] = [1]
compress = Compress()
compress.[2](app)
Drag options to blanks, or click blank then click option'
Ainit_app
B500
C1000
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' instead of 'init_app'.
Setting the size to 1000 instead of 500.
5fill in blank
hard

Fill all three blanks to create a Flask app, configure Flask-Compress, and initialize it.

Flask
from flask import Flask
from flask_compress import [1]

app = [2](__name__)
app.config['COMPRESS_ALGORITHM'] = '[3]'
compress = Compress()
compress.init_app(app)
Drag options to blanks, or click blank then click option'
ACompress
BFlask
Cgzip
Dcompress
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'compress' instead of 'Compress'.
Setting algorithm to 'compress' which is invalid.