These are chat archives for django/django

6th
Mar 2016
2xS
@i2xS
Mar 06 2016 07:11
Hi everyone! Can't find how to run celery task from shell synchronously, just like simple django's management command. Without any celery workers and beat. Is there any solution?
Filip Figiel
@megapctr
Mar 06 2016 07:27
I think you can call the task directly (instead of calling the delay method)
2xS
@i2xS
Mar 06 2016 09:38
thanks, @megapctr but i hoped it would be some call parameter like --local. bad luck
2xS
@i2xS
Mar 06 2016 10:00
not working for me. getting AlwaysEagerIgnored: CELERY_ALWAYS_EAGER has no effect on send_task ater running './manage.py celery call ecp'
so, how to call celery task from shell? I know I can call it from django shell, but I wan to use only command line
Sergey Tsaplin
@SergeyTsaplin
Mar 06 2016 10:06
@i2xS you can use 2 functions, for example:
def main_func():
def main_func(args, kwargs):
2xS
@i2xS
Mar 06 2016 10:09
@SergeyTsaplin one for celery task, one for management comand?
Sergey Tsaplin
@SergeyTsaplin
Mar 06 2016 10:11
F*ck. It's no way to add line separator from mobile :-( just make another function with task decorator which will be calling your main function without task decorator. Than you can use your main function without celery at all
Olansile Ajibola
@tantita
Mar 06 2016 14:52
hello, pls i need help with a django app i am creating
mpachas
@mpachas
Mar 06 2016 15:01
Si?
Olansile Ajibola
@tantita
Mar 06 2016 21:11
pls how do i perform eager loading of a foreign key model in django
Olansile Ajibola
@tantita
Mar 06 2016 21:47
@megapctr tnks, but it's still not loading it when I run model_to_dict or serializers.serialize
model_to_dict(Restaurants.objects.select_related('area').get(pk=1))
# or
serializers.serialize('json', Restaurants.objects.select_related('area').all())
I just get the normal result I get w/o the select_related
This message was deleted