Bird
0
0

Identify the error in this Flask static file optimization code:

medium📝 Debug Q6 of 15
Flask - Performance Optimization
Identify the error in this Flask static file optimization code:
app = Flask(__name__)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = '3600'
AThe cache duration should be an integer, not a string
BSEND_FILE_MAX_AGE_DEFAULT is not a valid config key
CFlask requires this setting to be set in minutes
DThe app variable must be named 'application'
Step-by-Step Solution
Solution:
  1. Step 1: Check data type of cache duration

    It should be an integer number, not a string.
  2. Step 2: Validate config key and naming

    SEND_FILE_MAX_AGE_DEFAULT is valid and app variable name is flexible.
  3. Final Answer:

    The cache duration should be an integer, not a string -> Option A
  4. Quick Check:

    Cache duration must be integer type [OK]
Quick Trick: Use integer values for cache duration [OK]
Common Mistakes:
MISTAKES
  • Using string instead of integer
  • Misnaming config keys
  • Assuming variable names are fixed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes