又拍云 Django5 存储后端
Project description
Django5 又拍云存储
用于又拍云的 Django5 存储后端。
安装
pip install django5-upyun-storage
配置
在您的 Django settings.py INSTALLED_APPS 中添加以下设置:
INSTALLED_APPS = [
...
'django5_upyun_storage',
...
]
在您的 Django settings.py 中添加以下设置:
UPYUN_STORAGE = {
'SERVICE': '服务名称',
'USERNAME': '授权账户',
'PASSWORD': '授权密码',
'DOMAIN': '绑定域名', # 可选,如果为空,则使用又拍云的默认域名 http://yourdomain.com
}
# 设置为默认存储器
STORAGES = {
'default': {
'BACKEND': 'django5_upyun_storage.storage.UpYunStorage',
},
'staticfiles': {
'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage',
}
}
使用
from django.db import models
class YourModel(models.Model):
file = models.FileField(upload_to='uploads/')
image = models.ImageField(upload_to='images/')
特性
- 兼容 Django 5.0+
- 支持所有基本文件操作
- 处理文件删除
- 可配置的上传路径
- 支持静态文件存储
许可证
MIT 许可证
贡献
欢迎贡献!请随时提交拉取请求。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django5-upyun-storage-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90b2420938b0ced2eea60cc59d944fde431f6efd49a5fcd594b1792e10af9fef |
|
MD5 | 0bab473091a16cb38b68ba6a8715934b |
|
BLAKE2b-256 | 7d210e36bbe3bd5afc159dfab9050a5556898e1615c6e2081f045b9457126e95 |
Close
Hashes for django5_upyun_storage-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 591eef226109e1a6e5420f631f43540d520f09d7664555e2fa8244c848be9e93 |
|
MD5 | 2b1878ae079862faa2c62305bc516852 |
|
BLAKE2b-256 | cde0e889f9008f51f62e9c8f09fe305799386f14bac47c754da4a7d6659c6007 |