Skip to main content

A simple Django storage backend for aliyun oss2.

Project description

# Django Aliyun OSS2 Storage

### Django storage for [阿里云 OSS2](https://www.aliyun.com/product/oss/?spm=5176.383338.201.42.WB7sGd)

## Install

pip install django-aliyun-oss2-storage

## Configurations

Django Aliyun OSS2 Storage 需要以下几个配置才能正常工作。这些配置通过可以环境变量或 settings.py 来设置。环境变量的优先级要高于 settings.py 。BUCKET_NAME`是Bucket的名字,如果该bucket不存在,程序会自动创建。`BUCKET_ACL_TYPE`用于设置Bucket的权限,可以设置为`private, public-read`和 `public-read-write

`python ACCESS_KEY_ID = "40ZhE1HyuWdllpMh" ACCESS_KEY_SECRET = "KbxtlKSvKyuyuymTiQvrxhsYFMguXy" END_POINT = "XXXX.oss-us-west-1.aliyuncs.com" BUCKET_NAME = "XXXX" BUCKET_ACL_TYPE = "private" # private, public-read, public-read-write `

## Usage

在 settings.py 里设置 DEFAULT_FILE_STORAGE :

`python # mediafile将自动上传 DEFAULT_FILE_STORAGE = 'aliyun-oss2-storage.backends.AliyunMediaStorage' # staticfile将自动上传 STATICFILES_STORAGE = 'aliyun-oss2-storage.backends.AliyunStaticStorage' `

## License

基于MIT许可证发布

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-aliyun-oss2-storage-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

File details

Details for the file django-aliyun-oss2-storage-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django-aliyun-oss2-storage-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2851d78c8312eb5a4127a5a514120815ab8210015f7e2fc928329d0953178b50
MD5 b00c1b1eccbc18fdcc5fcbf5d48406d8
BLAKE2b-256 027da245e040d3c45278f92984ac6ea09b755d2a5c7e4deda528bab45d675236

See more details on using hashes here.

Supported by

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