Attribute Error in CeleryBeat Due to DataBaseSceduler

156 Views Asked by At

I am trying to use celery for asynchronous jobs and am using celery, docker and digitalocean.

I have line that is depicted below in docker-compose file.

As you can see there is celery beat part.

In celery beat part, there is "django_celery_beat.schedulers:DatabaseScheduler" and as far as I understand it can not find django_celery_beat.schedulers:DatabaseScheduler. I could not understand how may I solve tha problem.

version: '3.3'
services:
    web:
        build: .
        image: proje
        command: gunicorn -b 0.0.0.0:8000 proje.wsgi -w 4 --timeout 300 -t 80
        restart: unless-stopped
        tty: true
        env_file:
            - ./.env.production
        networks:
            - app-network
        depends_on:
            - migration
            - database
            - redis
        healthcheck:
            test: ["CMD", "wget", "http://localhost/healthcheck"]
            interval: 3s
            timeout: 3s
            retries: 10
    celery:
        image: proje
        command: celery -A proje worker -l info -n worker1@%%h
        restart: unless-stopped
        networks:
            - app-network
        environment:
            - DJANGO_SETTINGS_MODULE=proje.settings
        env_file:
            - ./.env.production
        depends_on:
            - redis
    celerybeat:
        image: proje
        command: celery -A proje beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
        restart: unless-stopped
        networks:
            - app-network
        environment:
            - DJANGO_SETTINGS_MODULE=proje.settings
        env_file:
            - ./.env.production
        depends_on:
            - redis
    migration:
        image: proje
        command: python manage.py migrate
        volumes:
            - .:/usr/src/app/
        env_file:
            - ./.env.production
        depends_on:
            - database
        networks:
            - app-network
    webserver:
        image: nginx:alpine
        container_name: webserver
        restart: unless-stopped
        tty: true
        ports:
            - "80:80"
            - "443:443"
        volumes:
            - ./static/:/var/www/static/
            - ./conf/nginx/:/etc/nginx/conf.d/
            - webserver-logs:/var/log/nginx/
        networks:
            - app-network
    database:
        image: "postgres:12" # use latest official postgres version
        restart: unless-stopped
        env_file:
            - .databaseenv # configure postgres
        ports:
            - "5432:5432"
        volumes:
            - database-data:/var/lib/postgresql/data/
        networks:
            - app-network
    redis:
        image: "redis:5.0.8"
        restart: unless-stopped
        command:  [ "redis-server", "/redis.conf" ]
        working_dir: /var/lib/redis
        ports:
            - "6379:6379"
        volumes:
            - ./conf/redis/redis.conf:/redis.conf
            - redis-data:/var/lib/redis/
        networks:
            - app-network
#Docker Networks
networks:
    app-network:
        driver: bridge

volumes:
    database-data:
    webserver-logs:
    redis-data:

And it gives me result that is depicted below. I am stuck in my project for months.

Any help will be appreciated.

enter image description here

1

There are 1 best solutions below

0
On

I have uploaded all these to an Ubuntu server and it has worked. I think my computer(Win 10) has some incompatibility with.

Thanks.