def run(app=None, server='<STR_LIT>', host='<STR_LIT:127.0.0.1>', port=<NUM_LIT>,<EOL>interval=<NUM_LIT:1>, reloader=False, quiet=False, plugins=None, **kargs):
if NORUN: return<EOL>if reloader and not os.environ.get('<STR_LIT>'):<EOL><INDENT>try:<EOL><INDENT>fd, lockfile = tempfile.mkstemp(prefix='<STR_LIT>', suffix='<STR_LIT>')<EOL>os.close(fd) <EOL>while os.path.exists(lockfile):<EOL><INDENT>args = [sys.executable] + sys.argv<EOL>environ = os.environ.copy()<EOL>environ['<STR_LIT>'] = '<STR_LIT:true>'<EOL>environ['<STR_LIT>'] = lockfile<EOL>p = subprocess.Popen(args, env=environ)<EOL>while p.poll() is None: <EOL><INDENT>os.utime(lockfile, None) <EOL>time.sleep(interval)<EOL><DEDENT>if p.poll() != <NUM_LIT:3>:<EOL><INDENT>if os.path.exists(lockfile): os.unlink(lockfile)<EOL>sys.exit(p.poll())<EOL><DEDENT><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>pass<EOL><DEDENT>finally:<EOL><INDENT>if os.path.exists(lockfile):<EOL><INDENT>os.unlink(lockfile)<EOL><DEDENT><DEDENT>return<EOL><DEDENT>stderr = sys.stderr.write<EOL>try:<EOL><INDENT>app = app or default_app()<EOL>if isinstance(app, str):<EOL><INDENT>app = load_app(app)<EOL><DEDENT>if not callable(app):<EOL><INDENT>raise ValueError("<STR_LIT>" % app)<EOL><DEDENT>for plugin in plugins or []:<EOL><INDENT>app.install(plugin)<EOL><DEDENT>if server in server_names:<EOL><INDENT>server = server_names.get(server)<EOL><DEDENT>if isinstance(server, str):<EOL><INDENT>server = load(server)<EOL><DEDENT>if isinstance(server, type):<EOL><INDENT>server = server(host=host, port=port, **kargs)<EOL><DEDENT>if not isinstance(server, ServerAdapter):<EOL><INDENT>raise ValueError("<STR_LIT>" % server)<EOL><DEDENT>server.quiet = server.quiet or quiet<EOL>if not server.quiet:<EOL><INDENT>stderr("<STR_LIT>" % repr(server))<EOL>stderr("<STR_LIT>" % (server.host, server.port))<EOL>stderr("<STR_LIT>")<EOL><DEDENT>if reloader:<EOL><INDENT>lockfile = os.environ.get('<STR_LIT>')<EOL>bgcheck = FileCheckerThread(lockfile, interval)<EOL>with bgcheck:<EOL><INDENT>server.run(app)<EOL><DEDENT>if bgcheck.status == '<STR_LIT>':<EOL><INDENT>sys.exit(<NUM_LIT:3>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>server.run(app)<EOL><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>pass<EOL><DEDENT>except (SyntaxError, ImportError):<EOL><INDENT>if not reloader: raise<EOL>if not getattr(server, '<STR_LIT>', False): print_exc()<EOL>sys.exit(<NUM_LIT:3>)<EOL><DEDENT>finally:<EOL><INDENT>if not getattr(server, '<STR_LIT>', False): stderr('<STR_LIT>')<EOL><DEDENT>
Start a server instance. This method blocks until the server terminates.

        :param app: WSGI application or target string supported by
               :func:`load_app`. (default: :func:`default_app`)
        :param server: Server adapter to use. See :data:`server_names` keys
               for valid names or pass a :class:`ServerAdapter` subclass.
               (default: `wsgiref`)
        :param host: Server address to bind to. Pass ``0.0.0.0`` to listens on
               all interfaces including the external one. (default: 127.0.0.1)
        :param port: Server port to bind to. Values below 1024 require root
               privileges. (default: 8080)
        :param reloader: Start auto-reloading server? (default: False)
        :param interval: Auto-reloader interval in seconds (default: 1)
        :param quiet: Suppress output to stdout and stderr? (default: False)
        :param options: Options passed to the server adapter.