I have a Celery task that I run locally using celery -A tasks worker --loglevel=info
or sometimes it runs on a live server.
@app.task
def example_task_calling_api():
url = "http://127.0.0.1:8000/"
# url = "http://www.example.com/api/"
content = requests.get(url)
#Do something with content etc
At the moment I uncomment the url depending on what environment I'm running.
My question is, how can I pass into celery settings or extra args that I can use to setup the correct URL?
PS... I DON'T mean passing args to a task i.e. Task(123) but somesort of system wide variable set upon starting celery.
i.e. celery -A tasks worker --loglevel=info -LOCALDEV