0
0
Flaskframework~10 mins

WSGI servers (Gunicorn, uWSGI) 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 import the Flask class from the flask package.

Flask
from flask import [1]
app = Flask(__name__)
Drag options to blanks, or click blank then click option'
Ajsonify
BRequest
Crender_template
DFlask
Attempts:
3 left
💡 Hint
Common Mistakes
Importing Request instead of Flask
Using render_template which is for templates
Using jsonify which is for JSON responses
2fill in blank
medium

Complete the command to run a Flask app using Gunicorn on port 8000.

Flask
gunicorn [1]:app -b 0.0.0.0:8000
Drag options to blanks, or click blank then click option'
Aapp.py
Bflask_app
Capp
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Including the .py extension in the module name
Using a wrong module name that does not exist
3fill in blank
hard

Fix the error in the uWSGI command to serve the Flask app from app.py.

Flask
uwsgi --http :5000 --wsgi-file [1] --callable app
Drag options to blanks, or click blank then click option'
Aapp.py
Bapp
Cflask_app.py
Dmain.py
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the .py extension
Using a wrong filename
4fill in blank
hard

Fill both blanks to create a Gunicorn command that runs the app with 4 workers on port 8080.

Flask
gunicorn [1]:app -w [2] -b 0.0.0.0:8080
Drag options to blanks, or click blank then click option'
Aapp
B4
C2
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong module name
Setting workers to a string instead of a number
5fill in blank
hard

Fill all three blanks to create a uWSGI command that serves app.py with 2 processes and 4 threads on port 9090.

Flask
uwsgi --http :9090 --wsgi-file [1] --processes [2] --threads [3] --callable app
Drag options to blanks, or click blank then click option'
Aapp.py
B2
C4
Dapp
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the .py extension
Confusing processes and threads values
Using the callable name in place of the file