first commit
This commit is contained in:
22
core/celery.py
Normal file
22
core/celery.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import os
|
||||
from celery import Celery
|
||||
from django.conf import settings
|
||||
|
||||
# Django ayarlarını yükle
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||
|
||||
app = Celery('core')
|
||||
|
||||
# Django settings'ten Celery ayarlarını yükle
|
||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
|
||||
# Tüm Django app'lerinden task'ları otomatik keşfet
|
||||
app.autodiscover_tasks()
|
||||
|
||||
# Timezone ayarını zorla
|
||||
app.conf.enable_utc = settings.CELERY_ENABLE_UTC
|
||||
app.conf.timezone = settings.CELERY_TIMEZONE
|
||||
|
||||
@app.task(bind=True)
|
||||
def debug_task(self):
|
||||
print(f'Request: {self.request!r}')
|
||||
Reference in New Issue
Block a user