Last active
May 15, 2021 04:33
-
-
Save coci/3e4cd1223648504e726481ab57fee7ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
import os | |
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', 'sample.settings') | |
app = Celery('sample') | |
# Using a string here means the worker will not have to | |
# pickle the object when using Windows. | |
app.config_from_object('django.conf:settings') | |
app.autodiscover_tasks() | |
@app.task(bind=True) | |
def debug_task(self): | |
print('Request: {0!r}'.format(self.request)) | |
from __future__ import absolute_import | |
# 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 | |
BROKER_URL = os.environ.get("BROKER_URL", 'redis://redis_future_risk_management_redis:6379') | |
CELERY_RESULT_BACKEND = os.environ.get("CELERY_RESULT_BACKEND", 'redis://redis_future_risk_management_redis:6379') | |
CELERY_ACCEPT_CONTENT = ['application/json'] | |
CELERY_TASK_SERIALIZER = 'json' | |
CELERY_RESULT_SERIALIZER = 'json' | |
CELERY_TIMEZONE = 'Asia/Tehran' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment