Skip to main content
Django又拍云存储插件
=========================

**django-upyun** 为Django提供又拍云的接口.


Features
========

- Django file storage for UpYun
- Django static file storage for UpYun
- Works in Python 3.6

安装
============

* Install

开发版本:
.. code-block:: bash

$ pip install git+https://gitee.com/enlangs/django-upyun-storage.git


正式版本:
.. code-block:: bash
$ pip install django-upyun


- Add ``'django_upyun'`` to your ``INSTALLED_APPS`` setting
- Set your ``DEFAULT_FILE_STORAGE`` setting to ``"django_upyun.backends.UpYunMediaStorage"``
- Set your ``STATICFILES_STORAGE`` setting to ``"django_upyun.backends.UpYunStaticStorage"``
- Configure your UpYun Storage settings (Refer below).

Use the following settings for file storage.

.. code-block:: bash

# 配置静态文件;
STATICFILES_STORAGE = 'django-upyun.backends.UpYunStaticStorage'

# 配置上传文件使用UpYun存储,如:ImageField、FileField
DEFAULT_FILE_STORAGE = 'django-upyun.backends.UpYunMediaStorage'

认证设置
=======================

下面的三个设置用来登录upyun服务器

.. code-block:: bash

# 服务
UPY_SERVICE = <Your Service>

# 用户名
UPY_USERNAME = <Your username>

# 密码
UPY_PASSWORD = <Your password>

存储设置
=======================

使用的文件地址。

.. code-block:: bash

service_url = <地址,支持CDN>

重名文件覆盖设置
====================

针对重名文件的处理方式,如果为True,表示覆盖;为False表示文件名称+时间戳

.. code-block:: bash

UPY_NEED_COVERAGE = False


File storage settings
=====================

多媒体默认存储设置

.. code-block:: bash

# 文件默认存储的文件夹
MEDIA_URL = '/media/'


文件存储格式设置
===========================

设置上传后的文件存储到数据库中使用何种方式,为False表示存储为xxx.png

.. code-block:: bash

UPY_SAVE_FULL_URL = <True/False>


Staticfiles storage settings
============================

静态默认存储设置

.. code-block:: bash

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

.. code-block:: bash

$ python manage.py collectstatic


Testing
=======

需要如下三个配置,like linux系列可以使用环境变量设置。

.. code-block:: bash

$ 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 <https://gitee.com/enlangs/django-upyun-storage/issues>`_.

Release files for django-upyun 1.0.1

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-upyun 1.0.1
File Size Uploaded
django_upyun-1.0.1.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-upyun 1.0.1
File Interpreter ABI Platform
django_upyun-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / django_upyun-1.0.1.tar.gz

Download URL django_upyun-1.0.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c6310a0b10039f8239f06449dc408d85d5ba471faf1d5f8a800d320184c1efbb
BLAKE2b-256 checksum
How to use checksums
323e2d5975e3f533f56ed7005e4ee34c451c1b12994868ba8f094bfb42724161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_upyun-1.0.1-py3-none-any.whl

Download URL django_upyun-1.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1116e9c32bcaca7c1ff7de278197d29c188d0c52d7404300ebf3559657cac229
BLAKE2b-256 checksum
How to use checksums
aac5c0294a79cd8c52b35eb3666a49af16fda95374832bc2010509f7aeb6b8fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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