Skip to main content

``pq`` wrapper for django

Project description

pq wrapper for django.

https://travis-ci.org/jeanphix/dj-pq.svg?branch=master

Installation

pip install dj-pq

Configuration

Add dj_pq to your INSTALLED_APPS:

INSTALLED_APPS += [
    'dj_pq',
]

Apply migrations:

./manage.py migrate

Usage

dj-pq exposes the pq tasks API.

from dj_pq import get_queue

queue = get_queue('notifications')

@queue.task()
def notify(user_id):
    User.objects.get(id=user_id).notify()

notify(42)

Optionally a Queue can be bound to a specific database connection:

queue = get_queue('notifications', 'another_connection')

A worker command allows to start a worker for a given queue:

./manage.py worker notifications

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page