Azure Web App blocking AJAX requests to django application

I have a django (4.2.13 + python 3.10) application that at certain point makes AJAX requests to display progress to user while processing data from uploaded file.

When I try this locally on my computer (linux) it works well and progress bar is updated from data received in response of AJAX calls. Similarly it also works on a test server (linux + nginx + gunicorn) and displays progress without hassle.

On the browser side I use jQuery .post command to make calls.

When I deploy same app to the Azure Web App it doesn't allow any of the calls to go through, all remain in Pending state in the browser and there is absolutely no trace anywhere in the Azure logs.

Any hints?

OK, so I found a problem and finally resolved it. Azure Web App uses gunicorn to run python / django code and for some reason by default it spawns just one worker. Changed to start multiple workers and now everything works.

This is code you need to put into Web App configuration under Startup Command:

gunicorn --bind=0.0.0.0 --timeout 600 --workers=4 my_proj.wsgi:application

Hope this will help others with similar problems.

Back to Top