You start a Flask app using Gunicorn with the command gunicorn -w 4 app:app. What is the main effect of specifying -w 4?
Think about how Gunicorn manages multiple requests in production.
Gunicorn uses multiple worker processes to handle requests in parallel. The -w 4 option starts 4 separate worker processes.
You want to serve your Flask app using Gunicorn on port 8080. Which command is correct?
Check Gunicorn's option for binding to an address and port.
The --bind option specifies the address and port Gunicorn listens on. The correct syntax is --bind 0.0.0.0:8080.
You run gunicorn app.py to start your Flask app but Gunicorn fails with an error. What is the likely cause?
Consider how Gunicorn imports the Flask app.
Gunicorn requires the app to be specified as module_name:app_variable. Using a filename alone causes an import error.
--timeout option in Gunicorn?You run Gunicorn with --timeout 30. What happens if a worker takes longer than 30 seconds to respond?
Think about how Gunicorn handles stuck or slow workers.
The --timeout option sets the max time a worker can take. If exceeded, Gunicorn kills and restarts the worker to keep the app responsive.
Choose the best reason why Gunicorn is used to serve Flask apps in production instead of Flask's built-in server.
Consider concurrency and stability in production environments.
Flask's built-in server is single-threaded and not designed for production. Gunicorn uses multiple worker processes to handle many requests safely and efficiently.