Recall & Review
beginner
What does WSGI stand for and why is it important in Python web development?
WSGI stands for Web Server Gateway Interface. It is a standard interface between web servers and Python web applications or frameworks. It allows web servers to communicate with Python code in a consistent way.
Click to reveal answer
beginner
What is Gunicorn and what role does it play when deploying a Flask app?
Gunicorn is a WSGI HTTP server for Python. It runs your Flask app and handles multiple requests by managing worker processes, making your app ready to serve many users efficiently.
Click to reveal answer
intermediate
How does uWSGI differ from Gunicorn in serving Flask applications?
uWSGI is another WSGI server that supports more protocols and features than Gunicorn. It is highly configurable and can serve Python apps but also supports other languages. Gunicorn is simpler and focused on Python WSGI apps.
Click to reveal answer
beginner
Why should you not use Flask's built-in server in production?
Flask's built-in server is meant for development only. It is single-threaded and not designed to handle many users or heavy traffic. WSGI servers like Gunicorn or uWSGI are made for production and can handle multiple requests safely.
Click to reveal answer
intermediate
What is a worker process in the context of Gunicorn or uWSGI?
A worker process is a separate process that handles incoming web requests. Multiple workers allow your app to handle many users at the same time by running requests in parallel.
Click to reveal answer
What is the main purpose of a WSGI server like Gunicorn?
✗ Incorrect
WSGI servers like Gunicorn run Python web apps and manage multiple user requests efficiently.
Which of these is NOT a reason to use uWSGI over Flask's built-in server?
✗ Incorrect
uWSGI is more complex to configure than Flask's built-in server, which is simple but not suitable for production.
What happens if you run a Flask app with its built-in server in production?
✗ Incorrect
Flask's built-in server is not designed for production and can crash or slow down with many users.
In Gunicorn, what is the role of worker processes?
✗ Incorrect
Worker processes allow Gunicorn to handle multiple web requests at the same time.
Which command would you use to start a Flask app with Gunicorn?
✗ Incorrect
The command 'gunicorn app:app' starts the Flask app using Gunicorn as the WSGI server.
Explain what a WSGI server is and why it is needed when deploying a Flask application.
Think about how web servers talk to Python apps.
You got /4 concepts.
Compare Gunicorn and uWSGI in terms of features and typical use cases for Flask apps.
Consider ease of use versus configurability.
You got /4 concepts.