From 79233c408e445329c058f67978234aeae07ef054 Mon Sep 17 00:00:00 2001 From: Robert Einsle Date: Fri, 4 Aug 2017 17:49:33 +0200 Subject: [PATCH] remove celery from project --- billard/tasks.py | 3 +-- caromserver/__init__.py | 7 ------- caromserver/celery.py | 28 ---------------------------- caromserver/settings.py | 10 ---------- requirements.txt | 1 - 5 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 caromserver/celery.py diff --git a/billard/tasks.py b/billard/tasks.py index fceae52..0f2ecfc 100644 --- a/billard/tasks.py +++ b/billard/tasks.py @@ -2,13 +2,12 @@ from __future__ import absolute_import, unicode_literals import logging import billard.utils as utils -from celery import shared_task from billard.models import LocationData, Client, Accounting log = logging.getLogger(__name__) -@shared_task + def process_location_data(): data = LocationData.objects.filter(processed=False).order_by('tst') for ld in data: diff --git a/caromserver/__init__.py b/caromserver/__init__.py index 3b91b07..e69de29 100644 --- a/caromserver/__init__.py +++ b/caromserver/__init__.py @@ -1,7 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -# This will make sure the app is always imported when -# Django starts so that shared_task will use this app. -from .celery import app as celery_app - -__all__ = ['celery_app'] diff --git a/caromserver/celery.py b/caromserver/celery.py deleted file mode 100644 index 3e2522d..0000000 --- a/caromserver/celery.py +++ /dev/null @@ -1,28 +0,0 @@ -from __future__ import absolute_import, unicode_literals -import os -import django -from celery import Celery -from django.conf import settings - -# set the default Django settings module for the 'celery' program. -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'caromserver.settings') - -app = Celery(settings.CELERY_PREFIX) - -# Using a string here means the worker don't have to serialize -# the configuration object to child processes. -# - namespace='CELERY' means all celery-related configuration keys -# should have a `CELERY_` prefix. -app.config_from_object('django.conf:settings') - -# Load task modules from all registered Django app configs. - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "caromserver.settings") -django.setup() - -app.autodiscover_tasks(['billard']) - - -@app.task(bind=True) -def debug_task(self): - print('Request: {0!r}'.format(self.request)) \ No newline at end of file diff --git a/caromserver/settings.py b/caromserver/settings.py index d6ee8c9..4a7afc6 100644 --- a/caromserver/settings.py +++ b/caromserver/settings.py @@ -138,14 +138,6 @@ LOGOUT_URL = 'logout' LOGIN_REDIRECT_URL = 'billard:location_index' LOGOUT_REDIRECT_URL = 'billard:location_index' -# CELERY STUFF -BROKER_URL = 'redis://localhost:6379' -CELERY_RESULT_BACKEND = 'redis://localhost:6379' -CELERY_ACCEPT_CONTENT = ['application/json'] -CELERY_TASK_SERIALIZER = 'json' -CELERY_RESULT_SERIALIZER = 'json' -CELERY_TIMEZONE = 'Europe/Berlin' - # Admin eMails ADMINS = ( ('Robert Einsle', 'robert@einsle.de'), @@ -162,8 +154,6 @@ URL_LOCATION_PROCESSOR = 'http://127.0.0.1:8000/billard/process_locationdata' STATIC_ROOT = "/srv/carom/carom-server/static/" -CELERY_PREFIX = 'carom' - try: from local_settings import * except ImportError: diff --git a/requirements.txt b/requirements.txt index 9163f14..ade0988 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -celery==4.0.2 Django>=1.11 django-crispy-forms==1.6.1 django-extensions>=1.7.0