Why am I getting a “‘NoneType’ object has no attribute ‘startswith'” error when trying to start my celery beat in the terminal using redbeat?

I’ve been working on getting redbeat setup & working with my Flask app but I cant seem to get it to start correctly. When I run the command

celery -A celery_config.celery beat --scheduler redbeat.RedBeatScheduler

I get this error originating from here which makes it seem like redis_url in conf is None

  File "/Users/test/Documents/Projects/Project/.venv/lib/python3.9/site-packages/redbeat/schedulers.py", line 401, in setup_schedule
    client = get_redis(self.app)
  File "/Users/test/Documents/Projects/Project/.venv/lib/python3.9/site-packages/redbeat/schedulers.py", line 124, in get_redis
    elif conf.redis_url.startswith('redis-sentinel') and 'sentinels' in redis_options:
AttributeError: 'NoneType' object has no attribute 'startswith'

I believe my setup has to be wrong somehow for this error to occur, but I’m not sure where/how. Any pointers/help is greatly appreciated to get this thing up and running. Here is some trimmed-down relevant code for how I’ve set it up & how I’m trying to use it.

application.py file where I create the Flask App and tie application.celery_app to the celery instance I create in the celery_config file

from flask import Flask, redirect, url_for
from extensions import ma, jwt, db, socketio
import config.const as CONSTANTS
from web.authentication import auth
from web.tasks import tasks
from flask_cors import CORS
from celery_config import init_celery

def create_app():
    application = Flask(__name__)
    configure_app(application)
    application.celery_app = init_celery(application)


    return application



def configure_app(application):
    application.config['SQLALCHEMY_DATABASE_URI'] = CONSTANTS.DB_CONNECTION_STRING
    application.config['SECRET_KEY'] = CONSTANTS.SECRET
    application.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
    application.config['PREFERRED_URL_SCHEME'] = 'https'

application = create_app()



if __name__ == '__main__':
    application.run(debug=True, use_reloader=False, port=5009)

Here is celery_config.py where celery is created and configured. I’m running redis locally in a terminal window.

from celery import Celery

celery = None


def make_celery(app):
    app.config.update(
        CELERY_BROKER_URL='redis://localhost:6379/0',
        CELERY_RESULT_BACKEND='redis://localhost:6379/0',
        REDBEAT_REDIS_URL='redis://localhost:6379/1'
    )

    celery = Celery(app.import_name, broker=app.config['CELERY_BROKER_URL'])

    celery.conf.update({
        'beat_scheduler': 'redbeat.RedBeatScheduler',
        'beat_schedule': {},
        'redbeat_key_prefix': 'redbeat:',
        'redbeat_redis_url': app.config['REDBEAT_REDIS_URL']
    })

    return celery


def init_celery(app):
    global celery
    celery = make_celery(app)
    return celery

And lastly this is the file I would be adding, editing, and removing tasks. I’m guessing the error is coming from here where I create new entries using RedBeatSchedulerEntry()

from celery.schedules import crontab
from flask import Blueprint, jsonify, request
from models.task import Task
from services.login_decorator import duo_login_required
import services.helpers as helpers
from datetime import datetime, timedelta
from redbeat import RedBeatSchedulerEntry
from celery_config import celery as celery_app



tasks = Blueprint('tasks', __name__)


@tasks.route('/create_task', methods=['POST'])
def create_new_task():

    try:
        body = request.json
        task = Task()



        if body['interval'] == True:
            task.name = body['name']
            task.type = body['type']
            task.url = body['url']
            task.interval = True
            task.interval_time = body['time']
            task.update()
            key = task.id
            args = [task.id, task.url]

            schedule = timedelta(minutes=int(task.interval_time))
            entry = RedBeatSchedulerEntry(key, 'myapp.tasks.task_function', schedule, args=args, kwargs={},
                                          app=celery_app)
            entry.save()

            return jsonify({'id': task.id, 'name': task.name, 'type': task.type, 'interval_time': body['time'],'interval': True, 'url': task.url}), 200

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật