Отношение "django_celery_beat_periodictask" не существует после докеризации celery_beat
У меня есть приложение Django с Nginx, Gunicorn, PostgreSQL и Celery, которое я докеризировал. При попытке добавить celery_beat в docker-compose.yml
я получаю django.db.utils.ProgrammingError: relation "django_celery_beat_periodictask" does not exist
, хотя миграции были выполнены успешно, и на панели администратора я вижу, что все вещи celery beat отображаются.
Однако celery_beat не запускается из-за этой ошибки, но я понятия не имею, откуда она может взяться.
Вот мой docker-compose.yml
:
version: '3.8'
services:
rabbitmq3:
container_name: rabbitmq
image: rabbitmq:3-alpine
ports:
- 5672:5672
postgres:
container_name: postgres
hostname: postgres
image: postgres:latest
env_file:
- env
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
- POSTGRES_DB=db
ports:
- "5432:5432"
restart: on-failure
volumes:
- postgresql-data:/var/lib/postgresql/data
django_gunicorn:
container_name: django_gunicorn
volumes:
- static:/app/static
- media:/app/media
env_file:
- env
build:
context: .
ports:
- "8000:8000"
command: sh -c "python manage.py migrate && python manage.py collectstatic --no-input && gunicorn main.wsgi:application --bind 0.0.0.0:8000"
depends_on:
- postgres
nginx:
container_name: nginx
build: ./nginx
volumes:
- .:/code
- static:/static
ports:
- "80:80"
depends_on:
- django_gunicorn
celery:
container_name: celery
volumes:
- media:/app/media
build:
context: .
command: celery -A main worker -P eventlet -c 100 -l INFO
env_file:
- env
restart: always
depends_on:
- rabbitmq3
- postgres
- django_gunicorn
celery_beat:
container_name: celery_beat
command: celery -A main beat --scheduler django_celery_beat.schedulers:DatabaseScheduler -l INFO
build:
context: .
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
- POSTGRES_DB=db
restart: on-failure
depends_on:
- rabbitmq3
- postgres
- django_gunicorn
volumes:
postgresql-data:
static:
media:
И полный отслеживание:
И postgres возвращает эту ошибку:
postgres | 2022-07-26 08:48:01.489 UTC [71] ERROR: relation "django_celery_beat_periodictask" does not exist at character 1078
postgres | 2022-07-26 08:48:01.489 UTC [71] STATEMENT: SELECT "django_celery_beat_periodictask"."id", "django_celery_beat_periodictask"."name", "django_celery_beat_periodictask"."task", "django_celery_beat_periodictask"."interval_id", "django_celery_beat_periodictask"."crontab_id", "django_celery_beat_periodictask"."solar_id", "django_celery_beat_periodictask"."clocked_id", "django_celery_beat_periodictask"."args", "django_celery_beat_periodictask"."kwargs", "django_celery_beat_periodictask"."queue", "django_celery_beat_periodictask"."exchange", "django_celery_beat_periodictask"."routing_key", "django_celery_beat_periodictask"."headers", "django_celery_beat_periodictask"."priority", "django_celery_beat_periodictask"."expires", "django_celery_beat_periodictask"."expire_seconds", "django_celery_beat_periodictask"."one_off", "django_celery_beat_periodictask"."start_time", "django_celery_beat_periodictask"."enabled", "django_celery_beat_periodictask"."last_run_at", "django_celery_beat_periodictask"."total_run_count", "django_celery_beat_periodictask"."date_changed", "django_celery_beat_periodictask"."description"
FROM "django_celery_beat_periodictask" WHERE "django_celery_beat_periodictask"."enabled"