Answer the question
In order to leave comments, you need to log in
How to generate full url in Celery task?
There is a celery task (django project), where the pk of the model is transferred and further manipulations are already performed in it. The problem is that in the task you need to form the full url. get_absoulute_url is not suitable (already in use). There is also request.build_absolute_uri(), but this object is naturally not available in the task. Googled it, the options are:
Answer the question
In order to leave comments, you need to log in
The 2nd option, for sure, except from request, it’s impossible to find out, so I would pass the host to the task, and I would already collect the full url in it. Well, the 3rd one with settings will also pull, but I was always embarrassed that you can set at least something there that is different from reality.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question