My man, you just made my day a whole better. I'm only slightly confused about the procedence of self.request in the debug_task, but might just be me. Great vid.
Glad I could help! When we ran `debug_task.delay()`, we placed a task in the Celery queue with all kinds of request information. That information got loaded into the worker as `self.request`. So, for our debug task we were simply printing the request. But for a real task, we would include some information in the request to help the worker know how to execute its job (e.g. the ID of a model in the database or raw arguments/data that we want to be transformed)
@@BennettGarner thanks for replying! What I don't quite get is if that request information you're giving to the worker would be the same request information that the view function is receiving.
@@fabriciosaavedra3795 In the example, there isn't a view function. Actually, if you look at the source code, there isn't even a `views.py`. Instead, the request information comes from the time and configuration when we executed `debug_task.delay()` in an interactive shell. While you could pass information from the view into your worker (and probably will want to), you'd do that using `debug_task.delay(task_information)`. Does that clarify things?
@@wanyoikedanny472 I'd suggest using Docker then to containerize it. Is there a reason your webserver/worker servers need to run on windows? It greatly complicates things and makes support difficult.
Could you please also make a tutorial video to set up tasks to fetch some data and save them in a database using celery in django. thanks in advance :)
Sure! Generally, anything you can do in Django, you can do in Celery. So, it would be as simple as fetching the data (whatever you have in mind) and then creating the model and saving it.
Hi. when I create other custom tasks and queue them up in shell, I get an importError. However, didn't get any error for debug_task. Could you please help me with this error? TA. :)
An import error likely means there's something wrong with how you're importing the task. Is it in another file, and are you sure the path to that file is correct in the import?