我应该将 Django-CMS 插件的媒体文件放在哪里?
我即将为我的 Django CMS 插件编写 setup.py
,但我不知道应该将图标放在哪里。
在我看来,根据您应该放置模板的位置来判断,以下内容是最直观的:
/media
/cms
/images
/plugins
my_image.png
cms_plugin.py
在 cms_plugin.py
中,我有以下方法:
def icon_src(self, instance):
print settings.CMS_MEDIA_URL
return settings.CMS_MEDIA_URL + u"images/plugins/my_image.png"
如果我重新执行,则上述方法有效使用 link.png
图像,但我正在寻找可以与我的插件捆绑在同一文件夹中的东西。
我缺少什么?
I'm about to write setup.py
for my Django CMS plugin, but I can't figure out where I'm supposed to put the icon.
It seemed to me like the following would've been the most intuitive, judging by where you are supposed to place templates:
/media
/cms
/images
/plugins
my_image.png
cms_plugin.py
In cms_plugin.py
I have the following method:
def icon_src(self, instance):
print settings.CMS_MEDIA_URL
return settings.CMS_MEDIA_URL + u"images/plugins/my_image.png"
The above works if I instead re-use the link.png
image, but I'm looking for something I can bundle in the same folder as my plugin.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是否是一个约定,但我注意到有一些人将其放入
或类似的约定中。
django-cms 扩展和插件
百日草
jplayer
I'm not sure if this is a convention or not but i've noticed a few put it in
or some such equivalent.
some examples from django-cms extensions and plugins
Zinnia
jplayer