A simple app that provides django integration for RQ (Redis Queue)
Project description
Django-RQ
Django integration with RQ, a Redis based Python queuing library. Django-RQ is a simple app that allows you to configure your queues in django’s settings.py and easily use them in your project.
Requirements
Installation
Install django-rq:
pip install django-rq
Add django_rq to INSTALLED_APPS in settings.py:
INSTALLED_APPS = ( # other apps "django_rq", )
Configure your queues in django’s settings.py (syntax based on Django’s database config)
RQ_QUEUES = { 'default': { 'HOST': 'localhost', 'PORT': 6379, 'DB': 0, }, 'high': { 'HOST': 'localhost', 'PORT': 6379, 'DB': 0, } 'low': { 'HOST': 'localhost', 'PORT': 6379, 'DB': 0, } }
Include django_rq.urls in your urls.py:
urlpatterns += patterns('', (r'^django_rq/', include('django_rq.urls')), )
Usage
Putting jobs in the queue
Django-RQ allows you to easily put jobs into any of the queues defined in settings.py. It comes with a few utility functions:
enqueue - push a job to the default queue:
import django_rq django_rq.enqueue(func, foo, bar=baz)
get_queue - accepts a single queue name argument (defaults to “default”) and returns an RQ Queue instance for you to queue jobs into:
import django_rq queue = django_rq.get_queue('high') queue.enqueue(func, foo, bar=baz)
get_connection - accepts a single queue name argument (defaults to “default”) and returns a connection to the queue’s Redis server:
import django_rq redis_conn = django_rq.get_connection('high')
Running workers
django_rq provides a management command that starts a worker for every queue specified as arguments:
python manage.py rqworkers high default low
Queue statistics
You can also monitor the status of your queues from /django_rq/. This uses some features that’s not yet available in RQ’s current stable release (0.1.3) so you’ll need to install RQ’s development version from https://github.com/nvie/rq to use this feature.
If you need a more sophisticated monitoring tools for RQ, you could also try rq-dashboard. provides a more comprehensive of monitoring tools.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-rq-0.1.2.tar.gz
.
File metadata
- Download URL: django-rq-0.1.2.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a6663b03fb4dd2f54eecc3832b501792056fd32e71a2cc6a5cd6cfa9d7fa15 |
|
MD5 | 48a9294bf6ba63f694d7bae18d129f37 |
|
BLAKE2b-256 | 68d8bff45258092bcab5cabb2d0e15d0cd0a86fa8d6cce8a3853c4891f861e86 |