def __init__(self): root = setting('UPYUN_STATIC_ROOT', '/static') super(UpYunStaticStorage, self).__init__(root=root) dirs = self.listdir(root)[0] while len(dirs) != 0: path = dirs.pop() print(path) dirs.extend(self.listdir(path)[0])
def __init__(self, username=None, password=None, bucket=None, root='/', timeout=60, endpoint=ED_AUTO, secret=None, token=None, domain=None): self._username = username or settings.UPYUN_USERNAME self._password = password or settings.UPYUN_PASSWORD self._bucket = bucket or settings.UPYUN_BUCKET self._hotlink_token = token or setting('UPYUN_HOTLINK_TOKEN', None) self._hotlink_token_expire = setting('UPYUN_HOTLINK_TOKEN_EXPIRE', 600) self._thumbnail_seperate = setting("UPYUN_THUMBNAIL_SEPERATE", '!') self._endpoint = endpoint if domain: self._domain = domain else: self._domain = '%s.%s' % (self._bucket, 'b0.upaiyun.com') self._timeout = timeout self._root = root self._api = None self._secret = secret self._entries = None self._protocol = setting('UPYUN_PROTOCOL', 'http')