Pyres is an excellent attempt of porting the Resque job queue to python. Pyres-django aims to be just a small collection of helpers for simple integration of pyres to django.
Pyres-django is yet unstable and perhaps not completely production-ready solution. Basically, this is just a set of my own shortcuts moved to a separate django application.
- Ensure that Pyres is installed and working.
- Checkout the app code to your project path:
git clone git://github.com/ruthenium/pyres_django.git
- Add 'pyres_django' to your INSTALLED_APPS.
- If needed, set the REDIS_HOST and REDIS_PORT config settings.
And that's it! Now everything should work.
- Redis server.
- Pyres and its dependencies.
- Django 1.3 or higher (because of class-based views in the web ui).
Import the get_pyres helper:
from pyres_django.helpers import get_pyres
Then anywhere in your code just do:
get_pyres().enqueue(SomeJob, *some_args)
Just type into your console:
$ QUEUES=q1,q2 python2 manage.py pyres_worker
And worker should run. If you would like to permanently define a queues list for it, you can set the PYRES_QUEUES variable in your settings.py.
Include pyres_django's urls.py as you usually do in your global urls.py:
urlpatterns = patterns('', url('^my-prefix', include('pyres_django.urls')), )
And now it will be available under your specified prefix.
According to the current implementation of the original ResWeb, It is not possible to use it under django without any patches. So I've had to re-implement the resweb-functionality my own way. It is still a "quick-and-dirty" solution, and I don't plan to develop it further, because the API of pyres is still not stablized and the ability of wsgi-integration of course will present in future versions.
Although, the basic implementation of a "True-way" wsgi integration can be found in the "wsgi" branch of this app.
- binarydud - an author of original pyres and resweb.
- alex - an author of the django-wsgi
- 2degrees - the authors of the twod.wsgi