Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding celeryd

Sample task set up and running periodically when you run "python manage.py celeryd -B".
Also visible in admin.... Need to find the results though... :-/
  • Loading branch information...
commit d11755868c7c359d1f3772da9b627a0a6c50fba0 1 parent 0f35116
Dustin Chesterman authored
View
32 rebootourschools/settings.py
@@ -2,7 +2,8 @@
#IMPORTS
import os
-#import djcelery
+import djcelery
+from datetime import timedelta
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -115,6 +116,28 @@
os.getcwd() + '/templates',
)
+
+# CELERY STUFF
+djcelery.setup_loader()
+BROKER_URL = "django://"
+BROKER_HOST = "localhost"
+BROKER_PORT = 5672
+BROKER_USER = "guest"
+BROKER_PASSWORD = "guest"
+BROKER_VHOST = "/"
+CELERYD_CONCURRENCY = "1"
+CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
+
+
+CELERYBEAT_SCHEDULE = {
+ "runs-every-30-seconds": {
+ "task": "technologytrackerapi.tasks.add",
+ "schedule": timedelta(seconds=5),
+ "args": (16, 16)
+ },
+}
+
+
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -123,9 +146,11 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'technologytracker',
+ 'technologytrackerapi',
'django.contrib.admin',
- # 'djcelery',
+ 'djcelery',
'django.contrib.admindocs',
+ 'kombu.transport.django',
)
# A sample logging configuration. The only tangible logging
@@ -155,6 +180,3 @@
from settings_dev import *
except ImportError, exp:
pass
-
-#CELERY LOADER
-#djcelery.setup_loader()
View
6 rebootourschools/technologytrackerapi/tasks.py
@@ -0,0 +1,6 @@
+from celery.decorators import task
+
+@task()
+def add(x, y):
+ return x + y
+
View
7 requirements.txt
@@ -1,6 +1,13 @@
Django==1.3.1
+amqplib==1.0.2
+anyjson==0.3.1
+celery==2.5.0
distribute==0.6.24
+django-celery==2.5.0
+django-picklefield==0.2.0
docutils==0.8.1
+kombu==2.1.1
psycopg2==2.4.4
+python-dateutil==1.5
wsgiref==0.1.2
yolk==0.4.3
Please sign in to comment.
Something went wrong with that request. Please try again.