Skip to main content

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

  • Put django_rq in your Python Path (installation via pip coming soon)

  • 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,
        },
        'test': {
            'HOST': 'localhost',
            'PORT': 1,
            'DB': 1,
        }
    }
  • 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('test')
    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('test')

Running workers

django_rq provides a management command that starts a worker for every queue defined in settings.py:

python manage.py rqworkers

Queue statistics

You can also monitor the status of your queues from /django_rq/.

Project details


Download files

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

Source Distribution

django-rq-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

File details

Details for the file django-rq-0.1.0.tar.gz.

File metadata

  • Download URL: django-rq-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-rq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e5d6190886af285d9bbcdc9146c1c4338949d0eeb432ce4816313a1496a8e412
MD5 75945c3571f3df7b2ba00c097a0d18ef
BLAKE2b-256 56ac4de639d50ea60653c5b77151d0363836e9704262387af8a79472ced15fcc

See more details on using hashes here.

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