From 1220d2d3cae9382338c34f9a0be3a9c116cd63e0 Mon Sep 17 00:00:00 2001 From: dongweiming Date: Wed, 5 Feb 2014 21:22:10 -0500 Subject: [PATCH] Modify some examples --- examples/app/myapp.py | 3 ++- examples/celery_http_gateway/settings.py | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/examples/app/myapp.py b/examples/app/myapp.py index f3de6be56..baa5c2b16 100644 --- a/examples/app/myapp.py +++ b/examples/app/myapp.py @@ -25,7 +25,8 @@ name using the fully qualified form:: from celery import Celery app = Celery('myapp', broker='amqp://guest@localhost//') - +# New When celery > 3.1, must specify result_backend +app.conf.CELERY_RESULT_BACKEND = 'amqp' @app.task() def add(x, y): diff --git a/examples/celery_http_gateway/settings.py b/examples/celery_http_gateway/settings.py index c80957b23..9ef334b05 100644 --- a/examples/celery_http_gateway/settings.py +++ b/examples/celery_http_gateway/settings.py @@ -13,8 +13,14 @@ ADMINS = ( MANAGERS = ADMINS +# Notes: Django 1.3 deprecated the old-style way of specifying databases, +# using 'django.db.backends.XXX' where XXX is one of: # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_ENGINE = 'sqlite3' +import django +if django.VERSION[:3] > (1, 3): + DATABASE_ENGINE = 'django.db.backends.sqlite3' +else: + DATABASE_ENGINE = 'sqlite3' # path to database file if using sqlite3. DATABASE_NAME = 'development.db' @@ -31,6 +37,17 @@ DATABASE_HOST = '' # Set to empty string for default. Not used with sqlite3. DATABASE_PORT = '' +DATABASES = { + 'default': { + 'ENGINE': DATABASE_ENGINE, + 'NAME': DATABASE_NAME, + 'USER': DATABASE_USER, + 'PASSWORD': DATABASE_PASSWORD, + 'HOST': DATABASE_HOST, + 'PORT': DATABASE_PORT, + } +} + # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems.