Coder Social home page Coder Social logo

django-aliyun-oss2-storage's Introduction

Django Aliyun OSS2 Storage

Django storage for 阿里云 OSS2

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-readpublic-read-write

ACCESS_KEY_ID = "40ZhE1HyuWdllpMh"
ACCESS_KEY_SECRET = "KbxtlKSvKyuyuymTiQvrxhsYFMguXy"
END_POINT = "oss-us-west-1.aliyuncs.com"
BUCKET_NAME = "XXXX"
ALIYUN_OSS_CNAME = "" # 自定义域名,如果不需要可以不填写
BUCKET_ACL_TYPE = "private" # private, public-read, public-read-write

Usage

在 settings.py 里设置 DEFAULT_FILE_STORAGE :

# mediafile将自动上传
DEFAULT_FILE_STORAGE = 'aliyun_oss2_storage.backends.AliyunMediaStorage'
# staticfile将自动上传
STATICFILES_STORAGE = 'aliyun_oss2_storage.backends.AliyunStaticStorage'

License

基于MIT许可证发布

django-aliyun-oss2-storage's People

Contributors

andyxue avatar daimon99 avatar huhinka avatar inuyasha2012 avatar mrgaolei avatar neverstopeating avatar usunyu avatar xiewenya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.