Green Flask

The code for this example is located in the examples.flaskgreen.manage module.

This script demonstrates the use synchronous web frameworks such as flask in the context of asynchronous responses. It uses pulsar the greenio module to run flask on a pool of greenlet.

This configuration allows the use of the greenlet-friendly EchoGreen client within a flask response function. The Echo server starts at the same time as the Flask WSGI server.

To run the script:

python manage.py

and point to http://localhost:8080 or any other sub urls.

Main Classes

class examples.flaskgreen.manage.FlaskSite[source]

Configure a flask application to run on a GreenPool

class examples.flaskgreen.manage.EchoGreen(appname, wait, pool_size=5, loop=None)[source]

A client for the echo server to be used by the Flask application

class examples.flaskgreen.manage.FlaskSite[source]

Configure a flask application to run on a GreenPool

Components

In this snippet the following components are used:

For more information about writing server and clients check the writing clients tutorial.