Relative Content

Tag Archive for python-3.xsanic

python sanic framework Listeners doesn’t work

from loguru import logger from sanic import Sanic app = Sanic(__name__) @app.before_server_start async def start(*_): logger.info(“Server starting…”) @app.before_server_stop async def before_server_stop(*_): logger.info(“Server stopping…”) @app.after_server_stop async def after_stop(app, loop): logger.info(“Server shutting down…”) @app.route(“/”) async def test(request): return text(“test”) if __name__ == ‘__main__’: try: app.run(host=’0.0.0.0′, port=8000, workers=1) except KeyboardInterrupt: app.stop() I tried running the above code, when […]