MCPcopy Create free account
hub / github.com/pallets/quart / run

Method run

src/quart/app.py:777–890  ·  view source on GitHub ↗

Run this application. This is best used for development only, see Hypercorn for production servers. Arguments: host: Hostname to listen on. By default this is loopback only, use 0.0.0.0 to have the server listen externally. port: Port

(
        self,
        host: str | None = None,
        port: int | None = None,
        debug: bool | None = None,
        use_reloader: bool = True,
        loop: asyncio.AbstractEventLoop | None = None,
        ca_certs: str | None = None,
        certfile: str | None = None,
        keyfile: str | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

775 return context
776
777 def run(
778 self,
779 host: str | None = None,
780 port: int | None = None,
781 debug: bool | None = None,
782 use_reloader: bool = True,
783 loop: asyncio.AbstractEventLoop | None = None,
784 ca_certs: str | None = None,
785 certfile: str | None = None,
786 keyfile: str | None = None,
787 **kwargs: Any,
788 ) -> None:
789 """Run this application.
790
791 This is best used for development only, see Hypercorn for
792 production servers.
793
794 Arguments:
795 host: Hostname to listen on. By default this is loopback
796 only, use 0.0.0.0 to have the server listen externally.
797 port: Port number to listen on.
798 debug: If set enable (or disable) debug mode and debug output.
799 use_reloader: Automatically reload on code changes.
800 loop: Asyncio loop to create the server in, if None, take default one.
801 If specified it is the caller's responsibility to close and cleanup the
802 loop.
803 ca_certs: Path to the SSL CA certificate file.
804 certfile: Path to the SSL certificate file.
805 keyfile: Path to the SSL key file.
806 """
807 if kwargs:
808 warnings.warn(
809 f"Additional arguments, {','.join(kwargs.keys())}, are not supported.\n"
810 "They may be supported by Hypercorn, which is the ASGI server Quart "
811 "uses by default. This method is meant for development and debugging.",
812 stacklevel=2,
813 )
814
815 if loop is None:
816 loop = asyncio.new_event_loop()
817 asyncio.set_event_loop(loop)
818
819 if "QUART_DEBUG" in os.environ:
820 self.debug = get_debug_flag()
821
822 if debug is not None:
823 self.debug = debug
824
825 loop.set_debug(self.debug)
826
827 shutdown_event = asyncio.Event()
828
829 def _signal_handler(*_: Any) -> None:
830 shutdown_event.set()
831
832 for signal_name in {"SIGINT", "SIGTERM", "SIGBREAK"}:
833 if hasattr(signal, signal_name):
834 try:

Callers 6

decoratorFunction · 0.80
run_commandFunction · 0.80
runFunction · 0.80
runFunction · 0.80
runFunction · 0.80
runFunction · 0.80

Calls 8

run_taskMethod · 0.95
get_debug_flagFunction · 0.85
observe_changesFunction · 0.85
_cancel_all_tasksFunction · 0.85
restartFunction · 0.85
appendMethod · 0.80
getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected