终于可以到异步消息机制的高档产品啦~~~
不知能不能代替AJAX。。
参照官方文档试下:
中文文档:
http://docs.jinkan.org/docs/celery/getting-started/brokers/rabbitmq.html
http://docs.celeryproject.org/en/2.5/django/first-steps-with-django.html
tasks.py
from celery import task @task() def add(x, y): return x + y
settings.py可以这样配(用DJANGO的库):
import djcelery djcelery.setup_loader() BROKER_URL = 'django://' ..... # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ..... 'djcelery', 'celerytest', 'kombu.transport.django', )