text: There.
  Information
  The development server is not intended to be used on production systems. It was designed especially for development purposes and performs poorly under high load. For deployment setups have a look at the Application Deployment pages.
  Changed in version 0.10.
  The Werkzeug reloader constantly monitors modules and paths of your web application, and restarts the server if any of the observed files change.
  Since version 0.10, there are two backends the reloader supports:
  stat and
  watchdog.
  statbackend simply checks the
  mtimeof all files in a regular interval. This is sufficient for most cases, however, it is known to drain a laptop’s battery..
  The development server highlights the request logs in different colors based on the status code. On Windows, Colorama must be installed as well to enable this..
  In some cases it can be useful to shut down a server after handling a request. For example, a local command line tool that needs OAuth authentication could temporarily start a server to listen for a response, record the user’s token, then stop the server.
  One method to do this could be to start a server in a
  multiprocessing process, then terminate the process after a value is passed back to the parent.
  import multiprocessing from werkzeug import Request, Response, run_simple def get_token(q: multiprocessing.Queue) -> None: @Request.application def app(request: Request) -> Response: q.put(request.args["token"]) return Response("", 204) run_simple("localhost", 5000, app) if __name__ == "__main__": q = multiprocessing.Queue() p = multiprocessing.Process(target=get_token, args=(q,)) p.start() print("waiting") token = q.get(block=True) p.terminate() print(token)
  That example uses Werkzeug’s development server, but any production server that can be started as a Python process could use the same technique and should be preferred for security. Another method could be to start a
  subprocess process and send the value back over
  stdout.
  Deprecated since version 2.0: Shutting down the server with
  environ["werkzeug.server.shutdown"] is deprecated and will be removed in Werkzeug 2.1.
  The development server provides a way to shutdown the server from a request. This will only work with the development server. The development server injects a function into the WSGI environ with the
  "werkzeug.server.shutdown" key.
  def shutdown_server(environ): shutdown = environ.get("werkzeug.server.shutdown") if shutdown is None: raise RuntimeError("Not running the development server.") shutdown())
  New in version 0.6.
  The builtin server supports SSL for testing purposes. If an SSL context is provided it will be used. That means a server can either run in HTTP or HTTPS mode, but not both. to the
  run_simple() method:
  run_simple('localhost', 4000, application, ssl_context=('/path/to/the/key.crt', '/path/to/the/key.key'))
  You will have to acknowledge the certificate in your browser once then.
  You can use a
  ssl.SSLContext object instead of a tuple for full control over the TLS configuration.
  import ssl ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) ctx.load_cert_chain('ssl.cert', 'ssl.key') run_simple('localhost', 4000, application, ssl_context=ctx) cryptography library to be installed.
  The dev server can bind to a Unix socket instead of a TCP socket.
  run_simple() will bind to a Unix socket if the
  hostname parameter starts with
  'unix://'.
  from werkzeug.serving import run_simple run_simple('unix://example.sock', 0, app)