Why is Django blocking concurrent requests for one session?

I tried adding sleep(30)to the first line of my view. After that, I opened this page in two browser tabs. The first tab loaded the page after 30 seconds, and the second loaded it after 60 seconds. In the meantime, I managed to open the pages from another computer. Thus, it seems that Django is blocking concurrent requests from the same client.

This is very good for my application. And I would like to be sure that my site will work this way in the future. However, I did not find any documentation or articles describing the behavior of Django. Therefore, I'm still not sure if this is a feature or luck. Can someone explain how and why this works?

Actually, I need to block the session during processing. Of course, I can use some db flags or transactions. But I would not want to add a function that is already implemented in Django.

I am using python 2.6.5, django 1.4, ubuntu server, nginx and uwsgi. Tried both postgresql and sqlite.

My uwsgi settings:

<uwsgi>
    <pythonpath>/home/admin/app/src</pythonpath>
    <app mountpoint="/">
        <script>deploy.wsgi</script>
    </app>
    <workers>4</workers><!-- Not sure this is needed -->
    <processes>2</processes>
</uwsgi>

I also got the same effect with the runerver command.

+3
source share
1 answer

In fact, Django does not block concurrent requests.

(, chrome firefox) ( cookie sessionid ), . , , Django. , , .

+2

All Articles