0
0
Flaskframework~10 mins

Development server with debug mode 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 start the Flask development server.

Flask
if __name__ == '__main__':
    app.run([1]=True)
Drag options to blanks, or click blank then click option'
Aport
Bhost
Cthreaded
Ddebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'host' or 'port' instead of 'debug' to enable debug mode.
Forgetting to set any argument, so debug mode stays off.
2fill in blank
medium

Complete the code to run the Flask app on all network interfaces.

Flask
if __name__ == '__main__':
    app.run(host=[1])
Drag options to blanks, or click blank then click option'
A'127.0.0.1'
B'0.0.0.0'
C'localhost'
D'192.168.1.1'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'localhost' or '127.0.0.1' which only allow local access.
Using a random IP that might not be assigned to the machine.
3fill in blank
hard

Fix the error in the code to enable debug mode correctly.

Flask
if __name__ == '__main__':
    app.run(debug=[1])
Drag options to blanks, or click blank then click option'
ATrue
B'False'
C1
D'True'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing 'True' as a string instead of the boolean True.
Passing 1 which works but is less clear than True.
4fill in blank
hard

Fill both blanks to run the Flask app on port 8080 with debug mode on.

Flask
if __name__ == '__main__':
    app.run(port=[1], debug=[2])
Drag options to blanks, or click blank then click option'
A8080
B5000
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using the default port 5000 instead of 8080.
Setting debug to False or as a string.
5fill in blank
hard

Fill all three blanks to run the Flask app on all interfaces, port 3000, with debug mode enabled.

Flask
if __name__ == '__main__':
    app.run(host=[1], port=[2], debug=[3])
Drag options to blanks, or click blank then click option'
A'0.0.0.0'
B3000
CTrue
D'localhost'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'localhost' instead of '0.0.0.0' for host.
Using port 5000 instead of 3000.
Setting debug to 'True' as a string.