测试gitnore

This commit is contained in:
ladeng07
2022-05-06 15:45:57 +08:00
parent 12f390949b
commit 51552904f9
2347 changed files with 120102 additions and 53549 deletions
@@ -16,7 +16,6 @@ class StaticFilesHandlerMixin:
"""
Common methods used by WSGI and ASGI handlers.
"""
# May be used to differentiate between handler types (e.g. in a
# request_finished signal)
handles_files = True
@@ -42,7 +41,7 @@ class StaticFilesHandlerMixin:
"""
Return the relative path to the media file on disk for the given URL.
"""
relative_url = url[len(self.base_url[2]) :]
relative_url = url[len(self.base_url[2]):]
return url2pathname(relative_url)
def serve(self, request):
@@ -59,9 +58,7 @@ class StaticFilesHandlerMixin:
try:
return await sync_to_async(self.serve, thread_sensitive=False)(request)
except Http404 as e:
return await sync_to_async(response_for_exception, thread_sensitive=False)(
request, e
)
return await sync_to_async(response_for_exception, thread_sensitive=False)(request, e)
class StaticFilesHandler(StaticFilesHandlerMixin, WSGIHandler):
@@ -69,7 +66,6 @@ class StaticFilesHandler(StaticFilesHandlerMixin, WSGIHandler):
WSGI middleware that intercepts calls to the static files directory, as
defined by the STATIC_URL setting, and serves those files.
"""
def __init__(self, application):
self.application = application
self.base_url = urlparse(self.get_base_url())
@@ -86,14 +82,13 @@ class ASGIStaticFilesHandler(StaticFilesHandlerMixin, ASGIHandler):
ASGI application which wraps another and intercepts requests for static
files, passing them off to Django's static file serving.
"""
def __init__(self, application):
self.application = application
self.base_url = urlparse(self.get_base_url())
async def __call__(self, scope, receive, send):
# Only even look at HTTP requests
if scope["type"] == "http" and self._should_handle(scope["path"]):
if scope['type'] == 'http' and self._should_handle(scope['path']):
# Serve static content
# (the one thing super() doesn't do is __call__, apparently)
return await super().__call__(scope, receive, send)