DeerU QINIU
DeerU七牛插件
安装
pip install deeru-qiniu
使用
运行初始化命令
python manage.py init_qiniu根据提示进行配置, 你也可以跳过此步,在admin的 “配置” 中添加名为 “七牛配置” 的配置,配置内容为:
{ 'access_key': 'access_key', 'secret_key': 'secret_key', 'bucket_name': '空间名', 'media_pre':'媒体文件前缀(可为空)', 'static_pre': '静态文件前缀(可为空)' }或是在 settings_local.py 中添加如下配置:
QINIU = { 'access_key': 'access_key', 'secret_key': 'secret_key', 'bucket_name': '空间名', 'media_pre':'媒体文件前缀(可为空)', 'static_pre': '静态文件前缀(可为空)' }修改settings
在 settings_local.py 的 CUSTOM_APPS 中添加app, 修改或添加 STATIC_URL 、 MEDIA_URL 内容为七牛的域名,如果你设置了前缀,需要加上前缀
CUSTOM_APPS = [ 'deeru_qiniu.apps.DeeruQiniuConfig' ] STATIC_URL='http://xx.bkt.clouddn.com/你的前缀/' MEDIA_URL='http://xx.bkt.clouddn.com/你的前缀/'上传文件
运行命令上传文件
# 上传媒体文件 python manage.py upload_qiniu --type media # 上传静态文件,上传静态文件前先运行collectstatic命令 python manage.py collectstatic python manage.py upload_qiniu --type static若有相同名字的文件会上传失败,可用删除命令删除之前上传的文件
命令
删除命令
会删除所有媒体文件或静态文件,不支持单个文件删除,删除单个文件在七牛后台中自行删除
# 上传媒体文件
python manage.py delete_qiniu [--type (media|static) ]
配置说明
media_pre ,static_pre
url的前缀,可为空,建议设置防止与空间中的旧文件冲突
其他
如果文章中已经插入了图片,代理媒体文件会导致文章中的图片失效,需要重新编辑文章
license
GUN V3.0
Metadata
Release files for deeru-qiniu 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deeru-qiniu-1.0.0.tar.gz | 18.7 kB | Without provenance | Details for deeru-qiniu-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| deeru_qiniu-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for deeru_qiniu-1.0.0-py3-none-any.whl |
Total release size: 26.0 kB
Release files / deeru-qiniu-1.0.0.tar.gz
| Download URL | deeru-qiniu-1.0.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
036ec19acd2c0979c7d59c702556e47e597b72d8dbb7ab37d24db16d2b398235
|
|
BLAKE2b-256 checksum How to use checksums |
ef0e3f40acb3e7a5eadbc734fd281cc614c5df932d90458209bf437fde73619e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / deeru_qiniu-1.0.0-py3-none-any.whl
| Download URL | deeru_qiniu-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b1be697acfeb449b9687e24c61dbe13c3f05e54c8aaba934c67e5d9e85fc320
|
|
BLAKE2b-256 checksum How to use checksums |
51b1fe8816a54fdac5ad41cec0bddcbb4a7aea86bdeee4c16f222912fb67be51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for deeru-qiniu 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.