How to kill / reload / autoreload a django server having persistent connections like SSE ?

558 Views Asked by At

django-admin.py runserver is running while developing. I have an open webpage connected to my sse endpoint.

Seems like using django-sse breaks to server autoreload feature, cf. this issue.

What's worse is that if I manually restart the server (Ctr+C & django-admin.py runserver), it fails with a 'port already in use error' and I need to ps grep runserver kill whatever_id first, a true PITA.

So:

  • How comes using persistent connections breaks my dev workflow ?
  • Is there an easy workaround not involving patching django ?

In production I'm using a Procfile with foreman to launch gunicorn gevent workers. Here a manual restart goes fine (open connections are closed) but there's not autoreload feature nor any log printed in the terminal.

0

There are 0 best solutions below