I am using Nginx with gunicorn to host my Django app. In development I used the inbuilt python server to host my django app.(manage.py runserver). One of my definition in views.py inputs multiple apks(files) and performs actions on them, looped.

It worked perfectly fine in development. Since each apk(file) takes a lot of time for processing, on NGINX after few seconds I get a 501 error.(this is fine) User can re-navigate to another web page and let this process run in the background.

But soon after this my process is terminated, so if 5 files were uploaded, 2-3 apks would be scanned rest will still be in my uploaded folder. upload-> for_each_apk: (scan->addtodb->deleteapk)

From this I have concluded, that after X time Nginx goes on the new request, without completing the old request.(loop)

What can I do so that once any process is initiated, it will complete in the background. while user re-navigates to another pages.(use other views from django app).

I know my question is vague, I am new to Django, please ask for any details or conf files. Please help me to solve this irritating problem. I have tried all the Internet solutions like increasing workers limit, time, timeout in gunicorn, etc...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.