Django 又拍云存储插件
Project description
Django又拍云存储插件
django-upyun-storage 为Django提供又拍云的接口.
Features
Django file storage for UpYun
Django static file storage for UpYun
Works in Python 3.6
安装
Install
$ pip install git+https://gitee.com/enlangs/django-upyun-storage.git
Add 'django-upyun-storage' to your INSTALLED_APPS setting
Set your DEFAULT_FILE_STORAGE setting to "django-upyun-storage.backends.UpYunMediaStorage"
Set your STATICFILES_STORAGE setting to "django-upyun-storage.backends.UpYunStaticStorage"
Configure your UpYun Storage settings (Refer below).
Use the following settings for file storage.
# 配置静态文件;
STATICFILES_STORAGE = 'django-upyun-storage.backends.UpYunStaticStorage'
# 配置上传文件使用UpYun存储,如:ImageField、FileField
DEFAULT_FILE_STORAGE = 'django-upyun-storage.backends.UpYunMediaStorage'
认证设置
下面的三个设置用来登录upyun服务器
# 服务
UPY_SERVICE = <Your Service>
# 用户名
UPY_USERNAME = <Your username>
# 密码
UPY_PASSWORD = <Your password>
存储设置
使用的文件地址。
service_url = <地址,支持CDN>
重名文件覆盖设置
针对重名文件的处理方式,如果为True,表示覆盖;为False表示文件名称+时间戳
UPY_NEED_COVERAGE = False
File storage settings
多媒体默认存储设置
# 文件默认存储的文件夹
MEDIA_URL = '/media/'
文件存储格式设置
设置上传后的文件存储到数据库中使用何种方式,为False表示存储为xxx.png
UPY_SAVE_FULL_URL = <True/False>
Staticfiles storage settings
静态默认存储设置
# The default location for your static files
STATIC_URL = '/static/'
staticfiles provides command ‘collectstatic’. Run following command to collect all sub-folder ‘static’ of each app and upload to STATIC_URL.
$ python manage.py collectstatic
Testing
需要如下三个配置,like linux系列可以使用环境变量设置。
$ export UPY_SERVICE=<service>
$ export UPY_USERNAME=<username>
$ export UPY_PASSWORD=<password>
Support and announcements
Downloads and bug tracking can be found at the main project website.
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 Distributions
Built Distribution
Hashes for django_upyun-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 420b24bb297a23f2f46e11842b8d473f69e9280eb0149e7bab59028ed5b893e5 |
|
MD5 | d8807b387e1bc513d24efe9387f0973f |
|
BLAKE2b-256 | 2e8715be9a7d9ae09a3af6be35dced5ff3a5aea1b6d5bae52953fc335d56b876 |