Search code examples
djangomacosdjango-dev-server

Quit Django dev server but process doesn't stop


I'm developing on Mac OSX 10.8. Lately I've been noticing that when I've been running the dev server for a while, and then -C to exit, the process continues to run in the background. I have to do a ps to find the process and kill it, or it won't let me use the same address:port again.

I didn't have to do that in earlier versions of Django (I'm currently running 1.7.3 on this project). Seems a bit messy, but don't know of another way to stop the dev server and free the port/resources?

Rgds, Ross.


Solution

  • Django development server have multiple threads, so when closing main process, there might be some running threads in background. It happens when there is some request being processed (some long-term request can hang or if you're using websockets or something, connection might prevent closing thread).

    Check if all of your requests are properly closed before closing your server and it should shut down properly.