Can a development server buffer HTTP requests while reloading?

118 Views Asked by At

We all love that Django's development server (manage.py runserver) notices file changes and reloads. But I find that I often beat the dev server to the punch - I hit reload in my browser while the project is still reloading. This results in an "Unable to connect" error in my browser, because there is nothing listening on localhost:8000.

It would be better if my dev server buffered the incoming HTTP request while the project reloaded; if I reload at the wrong time, the server simply holds the request until the project is operational again and then processes it.

Perhaps Django's reloading system isn't conducive to this design. Maybe I'd need to run a separate buffering proxy to make this work? Obviously simple approaches are preferred, but something that optimizes this would be a nice, frequently-felt improvement to my dev process.

1

There are 1 best solutions below

1
On

There is no simple way to do that without proxy server and I'm pretty sure that it won't happen in near future. Django runserver is not for that kind of use.

If it really bothers you, proxy your django dev server using nginx.