对Wagtail CMS的云支持
wagtailcloudinar的Python项目详细描述
#在wagtail中使用cloudinary
[wagtail admin中的cloudinary图像](./wagtailcloudinary.png)
\如果尚未完成,也可以添加cloudinary。
```
已安装的应用程序=[
…
‘cloudinary’,
‘wagtailcloudinary’,
…
]
````
在“设置”中输入您的云名称,将api-key和apy-secret导入cloudinary配置
```
import cloudinary
cloudinary.config(
cloud-name=<;your\u cloudinary-cloud-name>;
api-key=<;your\u cloudinary-api-key>;,
api-secret=<;your\u cloudinary-api-secret>;,
)
```
next edit your url.py如下:
```
from wagtailcloudinary import site
…
url(r'^wagtailcloudinary',include(site.url,namespace=“wagtailcloudinary”),
…
]
````
````在模型中的用法
`````
cloudinarywidget
类somepage(page):
image=cloudinaryfield()
content_panels=page.content_panels+[
fieldpanel('image',widget=cloudinarywidget),
]
`````
或在streamfield中使用
`从wagtailcloudinary.blocks导入cloudinaryimageblock`
[wagtail admin中的cloudinary图像](./wagtailcloudinary.png)
\如果尚未完成,也可以添加cloudinary。
```
已安装的应用程序=[
…
‘cloudinary’,
‘wagtailcloudinary’,
…
]
````
在“设置”中输入您的云名称,将api-key和apy-secret导入cloudinary配置
```
import cloudinary
cloudinary.config(
cloud-name=<;your\u cloudinary-cloud-name>;
api-key=<;your\u cloudinary-api-key>;,
api-secret=<;your\u cloudinary-api-secret>;,
)
```
next edit your url.py如下:
```
from wagtailcloudinary import site
url(r'^wagtailcloudinary',include(site.url,namespace=“wagtailcloudinary”),
…
]
````
````在模型中的用法
`````
cloudinarywidget
类somepage(page):
image=cloudinaryfield()
content_panels=page.content_panels+[
fieldpanel('image',widget=cloudinarywidget),
]
`````
或在streamfield中使用
`从wagtailcloudinary.blocks导入cloudinaryimageblock`