Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
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.
✗ Incorrect
The debug=True argument enables debug mode in Flask's development server.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
Using host='0.0.0.0' makes the server listen on all interfaces, allowing access from other devices.
3fill in blank
hardFix 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'
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.
✗ Incorrect
The debug parameter expects a boolean value, not a string.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the default port 5000 instead of 8080.
Setting debug to False or as a string.
✗ Incorrect
Port 8080 is a common alternative port, and debug=True enables debug mode.
5fill in blank
hardFill 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'
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.
✗ Incorrect
Host '0.0.0.0' listens on all interfaces, port 3000 is specified, and debug=True enables debug mode.