Git Product home page Git Product logo

django_store's Introduction

django_store

django 基于minio的文件存储存储服务

安装

pip install django_fstore

MinioStore对象说明

  • put_file 文件上传
  • put_chunk_object 文件分块上传
  • put_object 对象上传
  • get_object 获取对象
  • get_presigned_object 获取预签名的对象url

配置

django setting.py 配置

MINIO_ENDPOINT = '127.0.0.1:9000'
MINIO_ACCESS_KEY = 'abc'
MINIO_SECRET_KEY = 'cba'
MINIO_SECURE = False
MINIO_BUCKET_NAME = '2017'

django urls.py 配置

from django_store.views import MinioDownloadView, MinioOpenView, MinioSignedView

urlpatterns = patterns(
    '',
    url(r'^minio/download/$', MinioDownloadView.as_view(), name='minio_download'),
    url(r'^minio/open/$', MinioOpenView.as_view(), name='minio_open'),
    url(r'^minio/signed/$', MinioSignedView.as_view(), name='minio_signed'),
)

示例

文件上传

from django_store.store import MinioStore

def test(self, request):
    uf = request.FILES['plan_url_file']
    file_save_name = 'abc.pdf'

    ms = MinioStore()
    ms.put_file(uf, file_save_name)

文件打开

<a href="http://127.0.0.1:8000/minio/open/?file=abc.pdf">下载</a>

django_store's People

Contributors

9kl avatar

Watchers

 avatar  avatar

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.