Skip to main content

A django app for Tencent Cloud Object Storage. 腾讯云对象存储(COS)服务 for Django。

Project description

Django TencentCOS Storage

腾讯云对象存储(COS)服务 for Django。

环境要求

Python: >=3.7, <4

Django: >=2.2, <3.3

安装

pip install django-tencentcos-storage

基本使用

在项目的 settings.py 中设置 DEFAULT_FILE_STORAGE

DEFAULT_FILE_STORAGE = "tencentcos_storage.TencentCOSStorage"

此外,还需要设置腾讯云对象存储服务相关的必要信息:

TENCENTCOS_STORAGE = {
    "BUCKET": "存储桶名称",
    "CONFIG": {
        "Region": "地域信息",
        "SecretId": "密钥 SecretId",
        "SecretKey": "密钥 SecretKey",
    }
}

详情可参考 腾讯云对象存储官方文档

设置

示例

TENCENTCOS_STORAGE = {
    # 存储桶名称,必填
    "BUCKET": "存储桶名称",
    # 存储桶文件根路径,默认 '/'
    "ROOT_PATH": "/",
    # 腾讯云存储 Python SDK 的配置参数,详细说明请参考腾讯云官方文档
    "CONFIG": {
        "Region": "地域信息",
        "SecretId": "密钥 SecretId",
        "SecretKey": "密钥 SecretKey",
    }
}

说明

BUCKET

存储桶名称,必填

ROOT_PATH

文件根路径,默认为 '/'

CONFIG

腾讯云对象存储 Python SDK 的配置参数,其中 RegionSecretIdSecretKey 为必填参数。

关于配置参数的详细说明请参考 腾讯云对象存储 Python SDK 官方文档

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-tencentcos-storage-0.1.0.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

django_tencentcos_storage-0.1.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page