Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

A simple Django storage backend for aliyun oss2.

Project description

## Django aliyun OSS2

Django storage for [aliyun OSS](https://www.aliyun.com/product/oss)


## Features

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

## Install

```bash
$ pip install django-aliyun-oss2
```

## Configurations

put the following config in your `settings.py` file:

```python
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

# 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.

```python
# 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:

```bash
$ python manage.py collectstatic
```

## License

MIT LICENSE

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-aliyun-oss2-0.1.1.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page