use celerybeat

This commit is contained in:
2019-01-26 12:36:44 +03:00
parent 6a88f7da4b
commit ec01ab879f
8 changed files with 32 additions and 25 deletions

View File

@@ -8,6 +8,16 @@ app = Celery('telegram_bots')
app.config_from_object({
'broker_url': 'redis://127.0.0.1:6379/1',
'result_backend': 'django-db',
'beat_scheduler': 'django_celery_beat.schedulers:DatabaseScheduler',
'worker_concurrency': 4,
'ONCE': {
'backend': 'celery_once.backends.Redis',
'settings': {
'url': 'redis://localhost:6379/0',
'default_timeout': 60 * 60,
}
}
})
app.autodiscover_tasks()

View File

@@ -20,6 +20,8 @@ INSTALLED_APPS = [
'django_extensions',
'bootstrap4',
'djconfig',
'django_celery_results',
'django_celery_beat',
'config.suit_config.SuitConfig',
'django.contrib.admin',
@@ -73,7 +75,7 @@ DATABASES = {
DATABASES['default']['ATOMIC_REQUESTS'] = True
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Moscow'
USE_I18N = True
USE_L10N = True
USE_TZ = True