Example #1
0
 def static(self, uri, file_or_directory, pattern=r'/?.+',
            use_modified_since=True, use_content_range=False):
     """Register a root to serve files from. The input can either be a
     file or a directory. See
     """
     static_register(self, uri, file_or_directory, pattern,
                     use_modified_since, use_content_range)
Example #2
0
 def static(
     self,
     uri,
     file_or_directory,
     pattern=r"/?.+",
     use_modified_since=True,
     use_content_range=False,
     stream_large_files=False,
     name="static",
     host=None,
     strict_slashes=None,
     content_type=None,
 ):
     """Register a root to serve files from. The input can either be a
     file or a directory. See
     """
     static_register(
         self,
         uri,
         file_or_directory,
         pattern,
         use_modified_since,
         use_content_range,
         stream_large_files,
         name,
         host,
         strict_slashes,
         content_type,
     )
Example #3
0
 def static(self, uri, file_or_directory, pattern=r'/?.+',
            use_modified_since=True, use_content_range=False,
            stream_large_files=False):
     """Register a root to serve files from. The input can either be a
     file or a directory. See
     """
     static_register(self, uri, file_or_directory, pattern,
                     use_modified_since, use_content_range,
                     stream_large_files)
Example #4
0
 def static(self, uri, file_or_directory, pattern=r'/?.+',
            use_modified_since=True, use_content_range=False,
            stream_large_files=False, name='static', host=None):
     """Register a root to serve files from. The input can either be a
     file or a directory. See
     """
     static_register(self, uri, file_or_directory, pattern,
                     use_modified_since, use_content_range,
                     stream_large_files, name, host)
Example #5
0
    def static(
        self,
        uri,
        file_or_directory,
        pattern=r"/?.+",
        use_modified_since=True,
        use_content_range=False,
        stream_large_files=False,
        name="static",
        host=None,
        strict_slashes=None,
        content_type=None,
    ):
        """
        Register a root to serve files from. The input can either be a
        file or a directory. This method will enable an easy and simple way
        to setup the :class:`Route` necessary to serve the static files.

        :param uri: URL path to be used for serving static content
        :param file_or_directory: Path for the Static file/directory with
            static files
        :param pattern: Regex Pattern identifying the valid static files
        :param use_modified_since: If true, send file modified time, and return
            not modified if the browser's matches the server's
        :param use_content_range: If true, process header for range requests
            and sends the file part that is requested
        :param stream_large_files: If true, use the
            :func:`StreamingHTTPResponse.file_stream` handler rather
            than the :func:`HTTPResponse.file` handler to send the file.
            If this is an integer, this represents the threshold size to
            switch to :func:`StreamingHTTPResponse.file_stream`
        :param name: user defined name used for url_for
        :param host: Host IP or FQDN for the service to use
        :param strict_slashes: Instruct :class:`Sanic` to check if the request
            URLs need to terminate with a */*
        :param content_type: user defined content type for header
        :return: None
        """
        static_register(
            self,
            uri,
            file_or_directory,
            pattern,
            use_modified_since,
            use_content_range,
            stream_large_files,
            name,
            host,
            strict_slashes,
            content_type,
        )