Merge branch 'main' of github.com:sanic-org/sanic into middleware-revamp

This commit is contained in:
Adam Hopkins
2022-09-15 18:33:22 +03:00
18 changed files with 371 additions and 63 deletions

View File

@@ -958,6 +958,7 @@ class RouteMixin(metaclass=SanicMeta):
# serve from the folder
if not static.resource_type:
if not path.isfile(file_or_directory):
uri = uri.rstrip("/")
uri += "/<__file_uri__:path>"
elif static.resource_type == "dir":
if path.isfile(file_or_directory):
@@ -965,6 +966,7 @@ class RouteMixin(metaclass=SanicMeta):
"Resource type improperly identified as directory. "
f"'{file_or_directory}'"
)
uri = uri.rstrip("/")
uri += "/<__file_uri__:path>"
elif static.resource_type == "file" and not path.isfile(
file_or_directory

View File

@@ -191,6 +191,7 @@ class RunnerMixin(metaclass=SanicMeta):
fast: bool = False,
verbosity: int = 0,
motd_display: Optional[Dict[str, str]] = None,
coffee: bool = False,
auto_tls: bool = False,
) -> None:
if version == 3 and self.state.server_info:
@@ -265,6 +266,9 @@ class RunnerMixin(metaclass=SanicMeta):
except AttributeError: # no cov
workers = os.cpu_count() or 1
if coffee:
self.state.coffee = True
server_settings = self._helper(
host=host,
port=port,