WSGI Host Service is able to host WSGI based Python applications, such as Flask, Pyramid or Django. This allows whole systems to be built and run from, where classic Web parts are served from the former established Web frameworks, and running reactive parts of the application as WAMP components.

The WSGI Web application runs on a pool of worker threads, unmodified and as all WSGI applications in a synchronous, blocking mode. The WSGI application cannot directly interact with the WAMP router, due to the difference in synchronous versus asynchronous operation. However, full bidirectional WAMP integration can be achieved using the HTTP Bridge.


To configure a WSGI Web service, attach a dictionary element to a path in your Web transport: :




Must be "wsgi".


The WSGI app Python module to load.


The WSGI app Python object to use.


See here for a complete example.

Here is a minimal example using Flask. The overall files involved are:

Create a file with your Flask application object:

from flask import Flask, render_template

## Our WSGI application .. in this case Flask based
app = Flask(__name__)

def page_home():
   return render_template('index.html', message = "Hello from")

Create a Jinja template file templates/index.html (note the templates subfolder):

<!DOCTYPE html>
      <h1>{{ message }}</h1>

Add a Web Transport with a WSGI Host Service on a subpath within your node configuration:

   "controller": {
   "workers": [
         "type": "router",
         "options": {
            "pythonpath": [".."]
         "transports": [
               "type": "web",
               "endpoint": {
                  "type": "tcp",
                  "port": 8080
               "paths": {
                  "/": {
                     "type": "wsgi",
                     "module": "myapp",
                     "object": "app"
                  "ws": {
                     "type": "websocket"