0
0
Flaskframework~10 mins

Task queue concept in Flask - 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 class.

Flask
from flask import [1]
Drag options to blanks, or click blank then click option'
AQueue
BFlask
CTask
DRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Importing Queue or Task instead of Flask.
Using lowercase flask instead of Flask.
2fill in blank
medium

Complete the code to create a new Flask app instance.

Flask
app = [1](__name__)
Drag options to blanks, or click blank then click option'
AQueue
BRequest
CTask
DFlask
Attempts:
3 left
💡 Hint
Common Mistakes
Using Queue or Task instead of Flask to create the app.
Forgetting to pass __name__ as argument.
3fill in blank
hard

Fix the error in the code to define a background task function.

Flask
@app.task
def [1]():
    print('Task running')
Drag options to blanks, or click blank then click option'
Arun_task
Btask_run
Ctask
Dbackground
Attempts:
3 left
💡 Hint
Common Mistakes
Using names that do not match the decorator or cause confusion.
Using invalid function names.
4fill in blank
hard

Fill both blanks to create a task queue and add a task.

Flask
from celery import [1]
app = [2]('tasks')
Drag options to blanks, or click blank then click option'
ACelery
BFlask
CQueue
DTask
Attempts:
3 left
💡 Hint
Common Mistakes
Using Flask or Queue instead of Celery.
Not matching import and instantiation names.
5fill in blank
hard

Fill all three blanks to define and call a background task.

Flask
@app.task
def [1](x, y):
    return x [2] y
result = [3].delay(4, 5)
Drag options to blanks, or click blank then click option'
Aadd
B+
Dtask
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching function name and call.
Using wrong operator inside the function.