Skip to main content

Django aliyun OSS2

Django storage for aliyun OSS

Features

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

Install

$ pip install django-aliyun-oss2

Configurations

put the following config in your settings.py file:

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

# The URL of AliCloud OSS endpoint
# Refer https://www.alibabacloud.com/help/zh/doc-detail/31837.htm 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'

Usage

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 manage.py collectstatic

License

MIT LICENSE

Metadata

Release files for django-aliyun-oss2 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-aliyun-oss2 0.2
File Size Uploaded
django-aliyun-oss2-0.2.tar.gz 5.5 kB Details

Release files / django-aliyun-oss2-0.2.tar.gz

Download URL django-aliyun-oss2-0.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
15645b734e44cc367f1a1bf14437b0eb8255c03e5843a83afe37d4623345e3a6
BLAKE2b-256 checksum
How to use checksums
82b6440b918626c6551cddb1ad0a53187e6ef58fee96be1253bb9defe28fcb2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page