Skip to main content

A simple Django storage backend for aliyun oss2.

Project description

Django aliyun OSS2

Django storage for aliyun OSS


  • Django file storage for aliyun OSS
  • Django static file storage for aliyun OSS
  • Works in Python 3+


$ pip install django-aliyun-oss2


put the following config in your file:

ACCESS_KEY_ID = "<your access key id>"
ACCESS_KEY_SECRET = "<your access key secret>"

# The URL of AliCloud OSS endpoint
# Refer for OSS Region & Endpoint
END_POINT = "<your access endpoint>"
BUCKET_NAME = "<your bucket name>"  # if not exist in aliyun oss platform, it will created automatically
ALIYUN_OSS_CNAME = ""  # custom domain. optional
BUCKET_ACL_TYPE = "private"  # bucket access type. available value: private, public-read, public-read-write
ALIYUN_OSS_HTTPS = False  # optional config. determine use https or not. if not declare, this value will be False by default.

# storage media file
DEFAULT_FILE_STORAGE = 'django_aliyun_oss2.backends.AliyunMediaStorage'
# storage static file
STATICFILES_STORAGE = 'django_aliyun_oss2.backends.AliyunStaticStorage'


All of the static file storage settings are available for the staticfiles storage.

# The default location for your static files
STATIC_URL = '/static/'

Run following command to collect all sub-folder static of each app and upload to STATIC_URL:

$ python collectstatic



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-0.2.tar.gz (5.5 kB view hashes)

Uploaded source

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