mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 20:09:25 +00:00
celery
This commit is contained in:
@ -12,3 +12,9 @@
|
||||
# OR WITHIN THE LOCAL FILE "LICENSE"
|
||||
#
|
||||
#
|
||||
|
||||
# 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",)
|
||||
|
17
sith/celery.py
Normal file
17
sith/celery.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Set the default Django settings module for the 'celery' program.
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sith.settings")
|
||||
|
||||
app = Celery("sith")
|
||||
|
||||
# Using a string here means the worker doesn'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", namespace="CELERY")
|
||||
|
||||
# Load task modules from all registered Django apps.
|
||||
app.autodiscover_tasks()
|
@ -106,6 +106,8 @@ INSTALLED_APPS = (
|
||||
"django_jinja",
|
||||
"ninja_extra",
|
||||
"haystack",
|
||||
"django_celery_results",
|
||||
"django_celery_beat",
|
||||
"captcha",
|
||||
"core",
|
||||
"club",
|
||||
@ -336,6 +338,14 @@ EMAIL_BACKEND = env.str(
|
||||
EMAIL_HOST = env.str("EMAIL_HOST", default="localhost")
|
||||
EMAIL_PORT = env.int("EMAIL_PORT", default=25)
|
||||
|
||||
# Celery
|
||||
CELERY_TIMEZONE = TIME_ZONE
|
||||
CELERY_TASK_TRACK_STARTED = True
|
||||
CELERY_TASK_TIME_LIMIT = 30 * 60
|
||||
CElERY_BROKER_URL = env.str("CELERY_BROKER_URL", default="redis://localhost:6379/1")
|
||||
CELERY_RESULT_BACKEND = "django-db"
|
||||
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"
|
||||
|
||||
# Below this line, only Sith-specific variables are defined
|
||||
|
||||
SITH_URL = env.str("SITH_URL", default="127.0.0.1:8000")
|
||||
|
Reference in New Issue
Block a user