Django celery 4 - ValueError: invalid literal for int() with base 10 when start celery worker

前端 未结 1 722
一生所求
一生所求 2021-02-14 10:20

I have configured my celery.py as its documents but I put my celery broker url to AWS SQS but I cannot start it to work. When I run the celery worker, I get the ValueError as:

相关标签:
1条回答
  • 2021-02-14 10:58

    I encountered the same problem, and resolved it.

    First check (it's very likely) that your AWS access key ID or secret key contains 'xi/' somewhere, and that you have:

    BROKER_URL = "sqs://%s:%s@" % (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
    

    If so, then your problem is in URL unsafe keys, and the fix is:

    BROKER_URL = 'sqs://{0}:{1}@'.format(
        urllib.parse.quote(AWS_ACCESS_KEY_ID, safe=''),
        urllib.parse.quote(AWS_SECRET_ACCESS_KEY, safe='')
    )
    

    Note: Use urllib.quote if using Python 2.x

    0 讨论(0)
提交回复
热议问题