def is_static ( self , filename ) : if self . staticpaths is None : # We're not using static file support return False for path in self . staticpaths : if filename . startswith ( path ) : return True return False
django python check if static file exists
Check if a file is a static file ( which should be copied rather than compiled using Jinja2 ) .
def is_static(self, filename):
        """Check if a file is a static file (which should be copied, rather
        than compiled using Jinja2).

        A file is considered static if it lives in any of the directories
        specified in ``staticpaths``.

        :param filename: the name of the file to check

        """
        if self.staticpaths is None:
            # We're not using static file support
            return False

        for path in self.staticpaths:
            if filename.startswith(path):
                return True
        return False