From 6e8c726be1caee8537f46c1c3fa156c406f824f8 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Fri, 21 Feb 2014 15:57:17 +0000 Subject: [PATCH] cosmetics --- examples/app/myapp.py | 9 +++-- examples/celery_http_gateway/settings.py | 48 +++++++++--------------- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/examples/app/myapp.py b/examples/app/myapp.py index baa5c2b16..51a624b2a 100644 --- a/examples/app/myapp.py +++ b/examples/app/myapp.py @@ -24,9 +24,12 @@ 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 = Celery( + 'myapp', + broker='amqp://guest@localhost//', + # add result backend here if needed. + #backend='rpc' +) @app.task() def add(x, y): diff --git a/examples/celery_http_gateway/settings.py b/examples/celery_http_gateway/settings.py index 9ef334b05..750f18a7b 100644 --- a/examples/celery_http_gateway/settings.py +++ b/examples/celery_http_gateway/settings.py @@ -1,5 +1,7 @@ # Django settings for celery_http_gateway project. +import django + DEBUG = True TEMPLATE_DEBUG = DEBUG @@ -13,41 +15,25 @@ 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'. -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' - -# Not used with sqlite3. -DATABASE_USER = '' - -# Not used with sqlite3. -DATABASE_PASSWORD = '' - -# Set to empty string for localhost. Not used with sqlite3. -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, - } + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'development.db', + 'USER': '', + 'PASSWORD': '', + 'HOST': '', + 'PORT': '', + } } +if django.VERSION[:3] < (1, 3): + DATABASE_ENGINE = DATABASES['default']['ENGINE'] + DATABASE_NAME = DATABASES['default']['NAME'] + DATABASE_USER = DATABASES['default']['USER'] + DATABASE_PASSWORD = DATABASES['default']['PASSWORD'] + DATABASE_HOST = DATABASES['default']['HOST'] + DATABASE_PORT = DATABASES['default']['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.