Asynchronous thumbnails with django easy-thumbnails -


i have installed django easy-thumbanils 2.2. has worked now, decided make asynchronous improve performance. following docs, implemented following code:

models.py

#saved_file.connect(generate_aliases_global) -> code used synchronous operation @receiver(saved_file) def generate_thumbnails_async(sender, fieldfile, **kwargs): print('calling') #this being called during upload tasks.add.delay(10,2) # test function in tasks.py. confirmed being called , result outputted worker tasks.generate_thumbnails.delay(         model=sender, pk=fieldfile.instance.pk,         field=fieldfile.field.name) #this function not called???? 

tasks.py

from easy_thumbnails.files import generate_all_aliases  @task def generate_thumbnails(model, pk, field):     print('calling gen_thumb task') #not called models.py     instance = model._default_manager.get(pk=pk)     fieldfile = getattr(instance, field)     generate_all_aliases(fieldfile, include_global=true)  @shared_task def add(x, y):     print('calling ad task') #called models.py      return x + y 

why add task being called not generate_thumbnails task please?


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -