Wagtail CMS的Cloudinary支持
项目描述
在Wagtail中使用cloudinary
该项目仍在维护中,但现在我更倾向于使用以下方法 https://gitlab.com/thelabnyc/wagtail-cloudinary-image
关于
此软件包为Wagtail CMS添加了Cloudinary支持
安装
pip install wagtailcloudinary
支持Wagtail 2.4和Django 2.1。
配置
在您的INSTALLED_APPS列表中添加wagtailcloudinary应用程序。如果尚未完成,请添加cloudinary。
INSTALLED_APPS = [
...
'cloudinary',
'wagtailcloudinary',
...
]
在settings.py中,将cloud_name、api_key和api_secret添加到cloudinary配置中
import cloudinary
cloudinary.config(
cloud_name=<YOUR_CLOUDINARY_CLOUD_NAME>,
api_key=<YOUR_CLOUDINARY_API_KEY>,
api_secret=<YOUR_CLOUDINARY_API_SECRET>,
)
接下来,按照以下方式编辑您的urls.py
from wagtailcloudinary import site
urlpatterns = [
...
url(r'^wagtailcloudinary', include(site.urls, namespace="wagtailcloudinary")),
...
]
用法
在models.py中
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailcore.models import Page
from wagtailcloudinary.fields import CloudinaryField
from wagtailcloudinary.widgets import AdminCloudinaryChooser
class SomePage(Page):
image = CloudinaryField()
content_panels = Page.content_panels + [
FieldPanel('image', widget=AdminCloudinaryChooser),
]
或在streamfield中使用
from wagtailcloudinary.blocks import CloudinaryImageBlock
项目详情
关闭
wagtailcloudinary-2.1.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a8aa2c125ae8ed7124ae1291589cb03c67bbccf72761450b105e20869300d0ad |
|
MD5 | e4ff6056cdcb1351df1f251067e1135b |
|
BLAKE2b-256 | 68d658e3b07a6fb41110cd4ca6e07ab3fc9d2152761ffd7032b8d6b674e48453 |
关闭
wagtailcloudinary-2.1.2-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 17efc1d141ee4ebb7a14858d5d842924c2b1ff5da301f0ca62488386c347d227 |
|
MD5 | 62e676bef2e08df6b66b5663df62ff20 |
|
BLAKE2b-256 | 4e64169cdc3a19aa5688188f47eadbc02c2fc53944a47b3cf4de7e8041de9ec7 |