These are chat archives for django/django

11th
Oct 2017
patient
@patient
Oct 11 2017 06:05

redirect("/chef/{}/kitchen/".format(username))

Why not "reverse"?

Anish Shrestha
@annshress
Oct 11 2017 07:30
i want to schedule a task. Send mail at appropriate datetime. Whats a good thing to use? I see Celery as an answer a lot. But cant seem how i am supposed to schedule tasks.
Sambit
@sam2015
Oct 11 2017 08:58
@annshress Celerybeat will help check this:
Anish Shrestha
@annshress
Oct 11 2017 09:15
@sam2015 Thanks. Looking into it.
I could get it to work from documentation.
Anish Shrestha
@annshress
Oct 11 2017 10:35
@sam2015 So based on the blog, celery can be used to long-running code and run some code regularly
But how can I achieve my issue?

from celery import task


@task()
def my_task(model_instance):
    model_instance.call_a_method_at_particular_date_and_time()
    return True
patient
@patient
Oct 11 2017 10:37
@annshress Why do not use crontab instead celery?
Just create manage command for sending emails and call it with cron schedule
Anish Shrestha
@annshress
Oct 11 2017 10:45
but cron will call yearly once set
wont it?
i was simply trying to avoid that.
Anish Shrestha
@annshress
Oct 11 2017 10:49
Ohh
i didnot know about the 6th field
<YEAR>
Thanks @patient
Sambit
@sam2015
Oct 11 2017 16:28
@annshress In first terminal we will run our worker with celery -A worker command. And in another terminal you will run another celery for cron tasks which will run according to time u hv set and also ur function command will be some celery -A beat or something similar just search it๐Ÿ˜