Plone setting up static images directory

DustyRah

Plone 4.3 is installed at c:\Plone43 directory with the site.zcml located in c:\Plone43\parts\instance\etc\site.zcml

All I want to do is setup a directory where I can put some images or resources and be able to access them using a URL like http://wiki.mycompany.net:8080/++resources++PROJECTNAME/images/someimage.png

I have activated the plone.resource 1.0.2 but have no idea where to put any images now or how to configure it. I have heard people talking about zcml but I have no idea what zcml file they are talking about.

I added the line in the site.zcml and then the plone site would not come up so I had to remove it.

Can someone please help me configure a static resource folder please? I am ok to configure a global one directly in the site.zcml if its possible.

Current site.zcml looks like this:

<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:meta="http://namespaces.zope.org/meta"
xmlns:five="http://namespaces.zope.org/five">

<include package="Products.Five" />
<meta:redefinePermission from="zope2.Public" to="zope.Public" />


<!-- Load the meta -->
<include files="package-includes/*-meta.zcml" />
<five:loadProducts file="meta.zcml"/>

<!-- Load the configuration -->
<include files="package-includes/*-configure.zcml" />
<five:loadProducts />

<!-- Load the configuration overrides-->
<includeOverrides files="package-includes/*-overrides.zcml" />
<five:loadProductsOverrides />


<securityPolicy
  component="AccessControl.security.SecurityPolicy" />


</configure>
sdupton

Forget about site.zcml; just create an small add-on package that has (1) a directory for your static resources, (2) a configure.zcml file using a browser:resourceDirectory declaration. Put your add-on in source control somewhere.

Your package should set up the following structure (assumes UNIX, you can easily translate this to Windows equivalents as you see fit, rename package appropriately):

~/my-buildout $ cd src
~/my-buildout/src $ mkdir -p myorg.packagename/myorg/packagename/static
~/my-buildout/src $ cd myorg.packagename
~/my-buildout/src/myorg.packagename $ vim setup.py  # edit as needed
...  # see http://docs.python.org/2/distutils/setupscript.html
~/my-buildout/src/myorg.packagename $ vim myorg/__init__.py

Make your namespace package work (in myorg/__init__.py):

try:
    __import__('pkg_resources').declare_namespace(__name__)
except ImportError:
    from pkgutil import extend_path
    __path__ = extend_path(__path__, __name__)

Other boilerplate:

~/my-buildout/src/myorg.packagename $ echo "#" > myorg/packagename/__init__.py
~/my-buildout/src/myorg.packagename $ vim myorg/packagename/configure.zcml

Your configure.zcml should look like:

<configure
  xmlns="http://namespaces.zope.org/zope"
  xmlns:browser="http://namespaces.zope.org/browser">

  <browser:resourceDirectory
    name="MYPROJECTNAME"
    directory="static"
    />

</configure>

Installing add-ons is well-documented for Plone, so I am omitting description of that.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Plone:从getPersonalPortrait()获取人像可使用@@ images缩放,否则

来自分类Dev

Trouble at Setting Up Webserver

来自分类Dev

Website setting when setting up an app in Facebook devleopers?

来自分类Dev

Setting up $httpBackend inside test files

来自分类Dev

Setting up Xcode service in OS X server

来自分类Dev

Use Greasemonkey to change Text to Images (on a static site)?

来自分类Dev

Heroku does not show up my images

来自分类Dev

Setting up VirtualenvWrapper on Ubuntu 12.04: Location of virtualenvwrapper.sh?

来自分类Dev

setting up two git accounts on one machine based on parent folder

来自分类Dev

setting up Neo4j replication on two instances

来自分类Dev

NumPy speed up setting elements of 2D Array

来自分类Dev

Serving Static Content from same directory as service - Dropwizard

来自分类Dev

使插件与Plone 4和Plone 5兼容

来自分类Dev

Clean Up Prestashop's Original Product Images to Reduce Storage Usage

来自分类Dev

Set up htaccess redirect to an identically titled directory on a subdomain

来自分类Dev

Plone的字幕图片来源?

来自分类Dev

Plone:编辑portlet的名称

来自分类Dev

如何安装Plone?

来自分类Dev

无要求的Plone主题

来自分类Dev

Plone JavaScript Colorscheme

来自分类Dev

如何还原Plone 3?

来自分类Dev

Plone和AngularJS路由

来自分类Dev

How to avoid duplicating context-setting-up procedure when using base template?

来自分类Dev

停用plone.app.toolbar和plone.app.widgets

来自分类Dev

Plone @@ usergroup-userprefs使用plone.app.ldap崩溃

来自分类Dev

Plone-XSLT / Diazo-替换Plone门户-personaltools标记

来自分类Dev

避免创建Plone的默认内容

来自分类Dev

plone zodb错误CMFUid ASSERT

来自分类Dev

检查Plone PythonScript中的类型

Related 相关文章

热门标签

归档