mirror of
https://github.com/Balshgit/public.git
synced 2026-02-04 10:00:39 +03:00
github stars project celery-rabbit
This commit is contained in:
3
celery-rabbit-example/celery_config/__init__.py
Normal file
3
celery-rabbit-example/celery_config/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# from app_celery import app as my_celery_app
|
||||
#
|
||||
# __all__ = ('my_celery_app', )
|
||||
25
celery-rabbit-example/celery_config/app_celery.py
Normal file
25
celery-rabbit-example/celery_config/app_celery.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from celery import Celery
|
||||
from pathlib import Path
|
||||
from decouple import AutoConfig
|
||||
|
||||
BASE_DIR = Path.cwd().parent
|
||||
config = AutoConfig(search_path=BASE_DIR.joinpath('config'))
|
||||
|
||||
|
||||
RABBITMQ_DEFAULT_USER = config('RABBITMQ_DEFAULT_USER')
|
||||
RABBITMQ_DEFAULT_PASS = config('RABBITMQ_DEFAULT_PASS')
|
||||
RABBITMQ_PORT = config('RABBITMQ_PORT', cast=int, default=5672)
|
||||
RABBITMQ_HOST = config('RABBITMQ_HOST')
|
||||
|
||||
|
||||
app_celery_instance = Celery(
|
||||
'tasks',
|
||||
broker='amqp://{login}:{password}@{host}:{port}'.format(
|
||||
login=RABBITMQ_DEFAULT_USER,
|
||||
password=RABBITMQ_DEFAULT_PASS,
|
||||
host=RABBITMQ_HOST,
|
||||
port=RABBITMQ_PORT,
|
||||
),
|
||||
# TODO: try to get async results with and without backend configured
|
||||
backend='rpc://',
|
||||
)
|
||||
Reference in New Issue
Block a user