When trying to detect if Django is running, don't set SO_REUSEADDR on Windows.
Setting SO_REUSEADDR on a socket on Windows, allows the port to be reused as well, meaning that it's not a good way of detecting if the port is in use. But Windows allows binding even when the port is in the wait state, so we don't need it anyway.