0
0
Flaskframework~10 mins

Flask-SocketIO setup - 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 from the flask package.

Flask
from flask import [1]
Drag options to blanks, or click blank then click option'
ASocketIO
BFlask
Crender_template
Drequest
Attempts:
3 left
💡 Hint
Common Mistakes
Importing SocketIO instead of Flask
Using lowercase flask instead of Flask
Importing unrelated functions
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'
AFlask
Brender_template
CSocketIO
Drequest
Attempts:
3 left
💡 Hint
Common Mistakes
Using SocketIO instead of Flask to create app
Forgetting to pass __name__
Calling a function that is not a class
3fill in blank
hard

Fix the error in importing SocketIO from the flask_socketio package.

Flask
from flask_socketio import [1]
Drag options to blanks, or click blank then click option'
AFlask
Brequest
Crender_template
DSocketIO
Attempts:
3 left
💡 Hint
Common Mistakes
Importing Flask from flask_socketio
Importing unrelated functions
Misspelling SocketIO
4fill in blank
hard

Fill both blanks to initialize SocketIO with the Flask app and enable CORS.

Flask
socketio = [1](app, cors_allowed_origins=[2])
Drag options to blanks, or click blank then click option'
ASocketIO
BFlask
C'*'
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using Flask instead of SocketIO to initialize
Setting cors_allowed_origins to None
Forgetting to pass the app instance
5fill in blank
hard

Fill all three blanks to run the SocketIO server with debug mode enabled on port 5000.

Flask
if __name__ == '__main__':
    socketio.[1](debug=[2], port=[3])
Drag options to blanks, or click blank then click option'
Arun
BTrue
C5000
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using start instead of run
Setting debug to False or a string
Using wrong port number