Challenge - 5 Problems
Uvicorn Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate1:30remaining
What happens when you run Uvicorn with default settings?
You start a FastAPI app using
uvicorn main:app without extra options. What is the behavior of the server?Attempts:
2 left
💡 Hint
Think about the default host, port, and reload behavior of Uvicorn.
✗ Incorrect
By default, Uvicorn runs on 127.0.0.1 (localhost) at port 8000. It does not reload automatically unless the --reload flag is used.
📝 Syntax
intermediate1:30remaining
Which command correctly starts Uvicorn with auto-reload and on all interfaces?
You want to run your FastAPI app with Uvicorn so it reloads on code changes and listens on all network interfaces. Which command is correct?
Attempts:
2 left
💡 Hint
Check the correct syntax for flags and their order.
✗ Incorrect
The correct syntax uses double dashes for flags and spaces between flags and values. Both --reload and --host 0.0.0.0 are valid flags.
❓ state_output
advanced2:00remaining
What is the output when Uvicorn fails to bind to port 80?
You run
uvicorn main:app --host 0.0.0.0 --port 80 without root privileges on Linux. What error message or behavior will you see?Attempts:
2 left
💡 Hint
Ports below 1024 require special permissions on Unix systems.
✗ Incorrect
On Unix-like systems, binding to ports below 1024 requires root privileges. Without them, Uvicorn raises a PermissionError.
🔧 Debug
advanced2:00remaining
Why does Uvicorn not reload when using
--reload with a custom app import path?You run
uvicorn myproject.app:app --reload but changes in your code do not trigger reload. What is the most likely cause?Attempts:
2 left
💡 Hint
Check if the app path matches your project structure exactly.
✗ Incorrect
If the import path is wrong or the app variable is not found, Uvicorn cannot watch files properly and reload won't work.
🧠 Conceptual
expert2:30remaining
How does Uvicorn handle multiple worker processes?
You start Uvicorn with
--workers 4. What is true about how Uvicorn manages these workers?Attempts:
2 left
💡 Hint
Think about how Python handles concurrency with processes vs threads.
✗ Incorrect
Using --workers starts multiple independent processes. Each process runs its own instance of the app, allowing better CPU utilization.