<p dir="auto">Hi,<br>
I want to know how to stop server by code?</p>
<p dir="auto">Does it provide a function like stop ()?</p>
<p dir="auto">This was added in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="607878" data-permission-text="Title is private" data-url="https://github.com/pallets/werkzeug/issues/36" data-hovercard-type="issue" data-hovercard-url="/pallets/werkzeug/issues/36/hovercard" href="https://github.com/pallets/werkzeug/issues/36">#36</a> as a way to shutdown local applications, <code class="notranslate">environ["werkzeug.server.shutdown"]()</code>. However, the advice for quite some time has been to use a production server even when running local applications; the development server is <em>only</em> for development.</p>
<p dir="auto">The issue and code comments both describe the implementation as "horrible". The implementation of it is in fact pretty weird, having to touch a double underscore "really private" variable, as well as jump through hoops to work with the HTTP server loop and handle reloader processes.</p>
<p dir="auto">Additionally, users see this and then are confused why they can only shut down their application when using the development server. Or they want to be able to do more process management such as reloads, which is definitely out of scope.</p>
<p dir="auto">Is the shutdown function really serving a useful purpose at this point? If we remove it, maybe it can be replaced with a page in the deploy docs about running a production server in a subprocess.</p>