Skip to content
Snippets Groups Projects
Commit 34a51469 authored by Tomáš Čejka's avatar Tomáš Čejka
Browse files

celery: start periodic tasks

parent a0377f62
No related branches found
No related tags found
No related merge requests found
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import os import os
from celery import Celery from celery import Celery
from flowspy import settings
# set the default Django settings module for the 'celery' program. # set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'flowspy.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'flowspy.settings')
...@@ -16,6 +17,7 @@ app.config_from_object('django.conf:settings', namespace='CELERY') ...@@ -16,6 +17,7 @@ app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task modules from all registered Django app configs. # Load task modules from all registered Django app configs.
app.autodiscover_tasks() app.autodiscover_tasks()
app.conf.beat_schedule = settings.CELERYBEAT_SCHEDULE
@app.task(bind=True) @app.task(bind=True)
def debug_task(self): def debug_task(self):
......
...@@ -30,7 +30,7 @@ echo "starting redis" 1>&2 ...@@ -30,7 +30,7 @@ echo "starting redis" 1>&2
/usr/bin/redis-server & /usr/bin/redis-server &
echo "Starting FoD celeryd in background" 1>&2 echo "Starting FoD celeryd in background" 1>&2
celery worker -A flowspy --concurrency=2 --detach -l debug -f celery.log celery worker -A flowspy -B --concurrency=2 --detach -l debug -f celery.log
echo "Starting FoD gunicorn in foreground" 1>&2 echo "Starting FoD gunicorn in foreground" 1>&2
#exec ./manage.py runserver 0.0.0.0:8000 #exec ./manage.py runserver 0.0.0.0:8000
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment