[Answered ]-Celery task for file uploading in django wizard

2👍

Actually uploading a file is a request, therefore you need to handle it with a view and then do whatever you want to do, including starting a celery task to handle file manipulation. The problem with that approach is the inability to serve a regular response to client if celery task returns something (but you can, for example, ping a special url from client side periodically or use socket.io to deliver the results).

One thing doesn’t change – file upload, whether separate or within a regular form, is a request, and therefore you must first handle it with a view and only afterwards may pass received data to a task or handle it directly.

Further on, file upload handlers deal with receiving data from socket. I guess you could create one working in a celery task, or rather tasks, due to partial nature of data sent through sockets, but as far as I know your form data couldn’t be accessed before the file is uploaded anyway (or in the better case, you can access all data but the file), so there is no point in sending it to celery, especially if you need to create a response involving some manipulation on the file.

Leave a comment