Celery start
This commit is contained in:
parent
c64292efb0
commit
f4f5611eaf
5 changed files with 30 additions and 0 deletions
2
elections/tasks.py
Normal file
2
elections/tasks.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
def send_election_mail(election):
|
||||
pass
|
|
@ -0,0 +1,3 @@
|
|||
from .celery import app as celery_app
|
||||
|
||||
__all__ = ("celery_app",)
|
15
kadenios/celery.py
Normal file
15
kadenios/celery.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import os
|
||||
|
||||
from celery import Celery
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kadenios.settings.local")
|
||||
|
||||
app = Celery("kadenios")
|
||||
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||
|
||||
app.autodiscover_tasks()
|
||||
|
||||
|
||||
@app.task(bind=True)
|
||||
def debug_task(self):
|
||||
print(f"Request: {self.request!r}")
|
|
@ -53,6 +53,7 @@ INSTALLED_APPS = [
|
|||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"kadenios.apps.IgnoreSrcStaticFilesConfig",
|
||||
"django_celery_results",
|
||||
"shared",
|
||||
"elections",
|
||||
"faqs",
|
||||
|
@ -94,6 +95,13 @@ DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
|||
|
||||
DEFAULT_FROM_EMAIL = "Kadenios <klub-dev@ens.fr>"
|
||||
|
||||
# #############################################################################
|
||||
# Paramètres de Celery
|
||||
# #############################################################################
|
||||
|
||||
CELERY_RESULT_BACKEND = "django-db"
|
||||
CELERY_CACHE_BACKEND = "default"
|
||||
|
||||
# #############################################################################
|
||||
# Paramètres d'authentification
|
||||
# #############################################################################
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
django==3.2.*
|
||||
celery==5.1.*
|
||||
django-celery-results
|
||||
django-translated-fields==0.11.1
|
||||
authens>=0.1b2
|
||||
markdown
|
||||
|
|
Loading…
Reference in a new issue