在Django后台可以使用Qiniu的插件
Project description
# Django Qiniu Plugin
Django后台插件,使得Django的`admin`系统可以完美支持七牛上传。同时,也支持`xadmin`。
---------------------------
### 使用:
1. 在项目的`settings.py`文件中,配置以下信息:
```python
# 七牛配置
QINIU_DOMAIN = '七牛域名'
QINIU_ACCESS_KEY = '七牛的access_key'
QINIU_SECRET_KEY = '七牛的secret_key'
QINIU_BUCKET_NAME = '七牛的bucket_name(也即空间)'
```
2. 在`models.py`文件中,把需要保存七牛上传文件后的地址的字段,使用`QiniuField`,如下所示:
```python
from DjangoQiniu.models import QiniuField
from django import models
class Course(models.Model):
course_name = models.CharField(max_length=100)
video_url = models.QiniuField(max_length=100,qiniu_field='video_url',btn_title=u'上传到七牛')
```
其中`QiniuField`的`qiniu_field`必须传和当前字段一样的名字。`btn_title`不传则默认为`上传文件`。
Django后台插件,使得Django的`admin`系统可以完美支持七牛上传。同时,也支持`xadmin`。
---------------------------
### 使用:
1. 在项目的`settings.py`文件中,配置以下信息:
```python
# 七牛配置
QINIU_DOMAIN = '七牛域名'
QINIU_ACCESS_KEY = '七牛的access_key'
QINIU_SECRET_KEY = '七牛的secret_key'
QINIU_BUCKET_NAME = '七牛的bucket_name(也即空间)'
```
2. 在`models.py`文件中,把需要保存七牛上传文件后的地址的字段,使用`QiniuField`,如下所示:
```python
from DjangoQiniu.models import QiniuField
from django import models
class Course(models.Model):
course_name = models.CharField(max_length=100)
video_url = models.QiniuField(max_length=100,qiniu_field='video_url',btn_title=u'上传到七牛')
```
其中`QiniuField`的`qiniu_field`必须传和当前字段一样的名字。`btn_title`不传则默认为`上传文件`。
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 Distribution
DjangoQiniu-0.0.1.tar.gz
(7.4 kB
view hashes)
Built Distribution
Close
Hashes for DjangoQiniu-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12afbe334595e9643706239ede84750e48a52e16c4c87f88bd586ccdedca8b03 |
|
MD5 | 50c5e07ca0ab59745726fcf1335ab2da |
|
BLAKE2b-256 | 99655a4c1daf5343de8cfff3465c589c4280348630391da67fed6691a45bc24f |