Skip to main content

django command to serve sites with pulsar asynchronous framework

Project description

Asynchronous Django

Badges:license pyversions status pypiversion
CI:circleci coverage
Keywords:asynchronous, django, wsgi, websocket, redis

The pulse module is a django application for running a django web site with pulsar. Add it to the list of your INSTALLED_APPS:


and run the site via the pulse command:

python pulse

Check the django chat example djchat for a django chat application served by a multiprocessing pulsar server.

By default, the pulse command creates a Wsgi middleware which runs the django application in a separate thread of execution from the main event loop. This is a standard programming pattern when using asyncio with blocking functions. To control the number of thread workers in the event loop executor (which is a pool of threads) one uses the thread-workers option. For example, the following command:

python pulse -w 4 --thread-workers 20

will run four process based actors, each with an executor with up to 20 threads.


It is possible to run django in fully asynchronous mode, i.e. without running the middleware in the event loop executor. Currently, this is available when using PostgreSql backend only, and it requires the greenlet library.

To run django using greenlet support:

python pulse -w 4 --greenlet

By default it will run the django middleware on a pool of 100 greenlets (and therefore approximately 100 separate database connections per actor). To adjust this number:

python pulse -w 4 --greenlet 200

Django Chat Example

This is a web chat application which illustrates how to run a django site with pulsar and how to include pulsar asynchronous request middleware into django.

To run:

python pulse

If running for the first time, issue the:

python migrate

command and create the super user:

python createsuperuser

Message and data backend

By default, messages from connected (websocket) clients are synchronised via the pulsar data store which starts when the django site starts.

It is possible to specify a different data store via the data-store option. For example, it is possible to use redis as an alternative data store by issuing the following start up command:

python pulse --data-store redis://

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pulsar-django, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size pulsar-django-0.3.0.tar.gz (10.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page