# Django5 又拍云存储
用于又拍云的 Django5 存储后端。
## 安装
```bash
pip install django5-upyun-storage
```
## 配置
在您的 Django settings.py INSTALLED_APPS 中添加以下设置:
```python
INSTALLED_APPS = [
...
'django5_upyun_storage',
...
]
```
在您的 Django settings.py 中添加以下设置:
```python
UPYUN_STORAGE = {
'SERVICE': '服务名称',
'USERNAME': '授权账户',
'PASSWORD': '授权密码',
'DOMAIN': '绑定域名', # 可选,如果为空,则使用又拍云的默认域名 http://yourdomain.com
}
# 设置为默认存储器
STORAGES = {
'default': {
'BACKEND': 'django5_upyun_storage.storage.UpYunStorage',
},
'staticfiles': {
'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage',
}
}
```
## 使用
```python
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 许可证
## 贡献
欢迎贡献!请随时提交拉取请求。
Raw data
{
"_id": null,
"home_page": "https://github.com/mircool/django-upyun-storage.git",
"name": "django5-upyun-storage",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "django, upyun, storage, file upload",
"author": "Mircool",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7d/21/0e36bbe3bd5afc159dfab9050a5556898e1615c6e2081f045b9457126e95/django5-upyun-storage-1.0.4.tar.gz",
"platform": null,
"description": "# Django5 \u53c8\u62cd\u4e91\u5b58\u50a8\r\n\r\n\u7528\u4e8e\u53c8\u62cd\u4e91\u7684 Django5 \u5b58\u50a8\u540e\u7aef\u3002\r\n\r\n## \u5b89\u88c5\r\n\r\n```bash\r\npip install django5-upyun-storage\r\n```\r\n\r\n## \u914d\u7f6e\r\n\u5728\u60a8\u7684 Django settings.py INSTALLED_APPS \u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u8bbe\u7f6e\uff1a\r\n\r\n```python\r\nINSTALLED_APPS = [\r\n ...\r\n 'django5_upyun_storage',\r\n ...\r\n]\r\n```\r\n\r\n\r\n\u5728\u60a8\u7684 Django settings.py \u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u8bbe\u7f6e\uff1a\r\n\r\n```python\r\nUPYUN_STORAGE = {\r\n 'SERVICE': '\u670d\u52a1\u540d\u79f0',\r\n 'USERNAME': '\u6388\u6743\u8d26\u6237',\r\n 'PASSWORD': '\u6388\u6743\u5bc6\u7801',\r\n 'DOMAIN': '\u7ed1\u5b9a\u57df\u540d', # \u53ef\u9009\uff0c\u5982\u679c\u4e3a\u7a7a\uff0c\u5219\u4f7f\u7528\u53c8\u62cd\u4e91\u7684\u9ed8\u8ba4\u57df\u540d http://yourdomain.com\r\n}\r\n\r\n# \u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u5b58\u50a8\u5668\r\nSTORAGES = {\r\n 'default': {\r\n 'BACKEND': 'django5_upyun_storage.storage.UpYunStorage',\r\n },\r\n 'staticfiles': {\r\n 'BACKEND': 'django.contrib.staticfiles.storage.StaticFilesStorage',\r\n }\r\n}\r\n```\r\n\r\n## \u4f7f\u7528\r\n\r\n```python\r\nfrom django.db import models\r\n\r\nclass YourModel(models.Model):\r\n file = models.FileField(upload_to='uploads/')\r\n image = models.ImageField(upload_to='images/')\r\n```\r\n\r\n## \u7279\u6027\r\n\r\n- \u517c\u5bb9 Django 5.0+\r\n- \u652f\u6301\u6240\u6709\u57fa\u672c\u6587\u4ef6\u64cd\u4f5c\r\n- \u5904\u7406\u6587\u4ef6\u5220\u9664\r\n- \u53ef\u914d\u7f6e\u7684\u4e0a\u4f20\u8def\u5f84\r\n- \u652f\u6301\u9759\u6001\u6587\u4ef6\u5b58\u50a8\r\n\r\n## \u8bb8\u53ef\u8bc1\r\n\r\nMIT \u8bb8\u53ef\u8bc1\r\n\r\n## \u8d21\u732e\r\n\r\n\u6b22\u8fce\u8d21\u732e\uff01\u8bf7\u968f\u65f6\u63d0\u4ea4\u62c9\u53d6\u8bf7\u6c42\u3002\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "\u53c8\u62cd\u4e91 Django5 \u5b58\u50a8\u540e\u7aef",
"version": "1.0.4",
"project_urls": {
"Bug Tracker": "https://github.com/mircool/django-upyun-storage/issues",
"Homepage": "https://github.com/mircool/django-upyun-storage.git"
},
"split_keywords": [
"django",
" upyun",
" storage",
" file upload"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cde0e889f9008f51f62e9c8f09fe305799386f14bac47c754da4a7d6659c6007",
"md5": "2b1878ae079862faa2c62305bc516852",
"sha256": "591eef226109e1a6e5420f631f43540d520f09d7664555e2fa8244c848be9e93"
},
"downloads": -1,
"filename": "django5_upyun_storage-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2b1878ae079862faa2c62305bc516852",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5660,
"upload_time": "2024-10-27T01:12:02",
"upload_time_iso_8601": "2024-10-27T01:12:02.901481Z",
"url": "https://files.pythonhosted.org/packages/cd/e0/e889f9008f51f62e9c8f09fe305799386f14bac47c754da4a7d6659c6007/django5_upyun_storage-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7d210e36bbe3bd5afc159dfab9050a5556898e1615c6e2081f045b9457126e95",
"md5": "0bab473091a16cb38b68ba6a8715934b",
"sha256": "90b2420938b0ced2eea60cc59d944fde431f6efd49a5fcd594b1792e10af9fef"
},
"downloads": -1,
"filename": "django5-upyun-storage-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "0bab473091a16cb38b68ba6a8715934b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 5167,
"upload_time": "2024-10-27T01:12:04",
"upload_time_iso_8601": "2024-10-27T01:12:04.172349Z",
"url": "https://files.pythonhosted.org/packages/7d/21/0e36bbe3bd5afc159dfab9050a5556898e1615c6e2081f045b9457126e95/django5-upyun-storage-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-27 01:12:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mircool",
"github_project": "django-upyun-storage",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "django5-upyun-storage"
}