Web Server Gateway Interface (WSGI) is standard for forwarding request to web applications written on Python language. pygeoapi it self doesn’t implement WSGI since it is an API, therefore it is required a webframework to access HTTP requests and pass the information to pygeoapi
HTTP request --> Flask (flask_app.py) --> pygeopai API
the pygeoapi package integrates Flask as webframework for defining the API routes/end points and WSGI support.
The flask WSGI server can be easily run as a pygeoapi command with the option –flask:
pygeoapi serve --flask
Running a native Flask server is not advisable, the prefered option is as follows:
HTTP request --> WSGI server (gunicorn) --> Flask (flask_app.py) --> pygeoapi API
By having a specific WSGI server, the HTTPS are efficiently processed into threads/processes. The current docker pygeoapi implement such strategy (see section: Docker), it is prefered to implement pygeopai using docker solutions than running host native WSGI servers.
Gunicorn is one of several WSGI supporting server on python (list of server supporting WSGI: here). This server is simple to run from the command, e.g:
For extra configuration parameters like port binding, workers please consult the gunicorn settings