From e7caf39fbad53c5e21f8a233a43cb4b84654dc2c Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 17 Oct 2018 04:25:09 -0700 Subject: [PATCH] static_route --- responder/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/responder/api.py b/responder/api.py index 006fa3b..bc4ac76 100644 --- a/responder/api.py +++ b/responder/api.py @@ -42,6 +42,7 @@ class API: openapi=None, openapi_route="/schema.yml", static_dir="static", + static_route="/static", templates_dir="templates", enable_hsts=False, ): @@ -49,7 +50,7 @@ class API: self.version = version self.openapi_version = openapi self.static_dir = Path(os.path.abspath(static_dir)) - self.static_route = f"/{static_dir}" + self.static_route = static_route self.templates_dir = Path(os.path.abspath(templates_dir)) self.built_in_templates_dir = Path( os.path.abspath(os.path.dirname(__file__) + "/templates") @@ -199,7 +200,7 @@ class API: # Run on_request first. try: r = getattr(view, "on_request")(req, resp) - if hasattr(r, 'send'): + if hasattr(r, "send"): await r except AttributeError: pass @@ -209,7 +210,7 @@ class API: try: r = getattr(view, f"on_{method}")(req, resp) - if hasattr(r, 'send'): + if hasattr(r, "send"): await r except AttributeError: pass