Giter Club home page Giter Club logo

django-aliyun-oss's Introduction

django-aliyun-oss

Django backends storages for Aliyun OSS

嵌入了Aliyun OSS Python SDK开发包 0.3.2

================= 配置说明:

编辑settings.py

  1. DEFAULT_FILE_STORAGE = 'aliyun_oss.backends.oss.OSSStorage'

  2. OSS_ACCESS_URL 阿里云存储访问地址

杭州节点外网:oss.aliyuncs.com
              oss-cn-hangzhou.aliyuncs.com
青岛节点外网:oss-cn-qingdao.aliyuncs.com
杭州节点内网:oss-internal.aliyuncs.com   
              oss-cn-hangzhou-internal.aliyuncs.com
青岛节点内网:oss-cn-qingdao-internal.aliyuncs.com
  1. OSS_ACCESS_KEY_ID 阿里云OSS KeyID String类型

  2. OSS_SECRET_ACCESS_KEY OSS Secret String类型

  3. OSS_STORAGE_BUCKET_NAME BUCKET名

  4. OSS_HEADERS(optional) 公共Response HEADER

OSS_HEADERS = {
    'Cache-Control': 'max-age=31536000',
}
  1. OSS_DEFAULT_ACL(optional) 文件访问权限 默认 'public-read'

从requirements.txt安装

-e git+https://github.com/SUNNYWILLHAPPEN/django-aliyun-oss.git#egg=django-aliyun-oss

上述内容添加到requirements.txt即可。

django-aliyun-oss's People

Contributors

kkzxak47 avatar lhypj avatar waenwj avatar wangtai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-aliyun-oss's Issues

STATICFILES_STORAGE = 'aliyun_oss.backends.oss.OSSStorage' issue

STATICFILES_STORAGE = 'aliyun_oss.backends.oss.OSSStorage'

noah@noah-ubuntu-desktop:/mnt/data/nwblog$ python manage.py collectstatic

You have requested to collect static files at the destination
location as specified in your settings.

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/home/noah/.local/lib/python2.7/site-packages/django/core/management/init.py", line 363, in execute_from_command_line
utility.execute()
File "/home/noah/.local/lib/python2.7/site-packages/django/core/management/init.py", line 355, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/noah/.local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/noah/.local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/noah/.local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 199, in handle
collected = self.collect()
File "/home/noah/.local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 124, in collect
handler(path, prefixed_path, storage)
File "/home/noah/.local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 354, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/home/noah/.local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 260, in delete_file
if self.storage.exists(prefixed_path):
File "/home/noah/.local/lib/python2.7/site-packages/django/utils/functional.py", line 238, in inner
self._setup()
File "/home/noah/.local/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py", line 504, in _setup
self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()
File "/home/noah/.local/lib/python2.7/site-packages/django/core/files/storage.py", line 467, in get_storage_class
return import_string(import_path or settings.DEFAULT_FILE_STORAGE)
File "/home/noah/.local/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/noah/.local/lib/python2.7/site-packages/aliyun_oss/backends/oss.py", line 12, in
from aliyun_oss.oss.oss_api import OssAPI
File "/home/noah/.local/lib/python2.7/site-packages/aliyun_oss/oss/oss_api.py", line 652
print('\r%d%% ' % (rate_num), end=' ')
^
SyntaxError: invalid syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.