Newer versions of Grok now use fanstatic for delivering static assets.<br><br>Make sure you have something like this in your setup.py<br><br>setup(name='yourapp',<br> version=version,<br> description="",<br>
long_description="Your app",<br> # Get strings from <a href="http://www.python.org/pypi?%3Aaction=list_classifiers">http://www.python.org/pypi?%3Aaction=list_classifiers</a><br> classifiers=[],<br>
keywords="",<br> author="Someone",<br> author_email="<a href="mailto:dude@somewhere.com">dude@somewhere.com</a>",<br> url="<a href="http://www.somewhere.com">http://www.somewhere.com</a>",<br>
license="",<br> package_dir={'': 'src'},<br> packages=find_packages('src'),<br> include_package_data=True,<br> zip_safe=False,<br> install_requires=[<br> 'setuptools',<br>
'grok',<br> 'grokui.admin',<br> 'fanstatic',<br> 'zope.fanstatic',<br> 'grokcore.startup',<br> 'zope.sendmail',<br> ],<br>
entry_points={<br> 'fanstatic.libraries': [<br> 'your_app = your_app.resource:library',<br> ]<br> },<br> )<br><br>The entry_points thing is very important. To know why look here: <a href="http://www.fanstatic.org/en/latest/library.html#making-fanstatic-available-in-your-project">http://www.fanstatic.org/en/latest/library.html#making-fanstatic-available-in-your-project</a><br>
<br>Also, fanstatic filter must be declared in your paster.ini file (might be in etc/<a href="http://debug.ini.in">debug.ini.in</a>).<br><br>[DEFAULT]<br>zope_conf = %(here)s/zope.debug.conf<br><br>[server:main]<br>use = egg:Paste#http<br>
host = 8000<br><br>[pipeline:main]<br>pipeline = accesslogging evalexception fanstatic grok<br><br>[filter:accesslogging]<br>use = egg:Paste#translogger<br><br>[filter:evalexception]<br>use = egg:z3c.evalexception#ajax<br>
<br>[filter:fanstatic]<br>use = egg:fanstatic#fanstatic<br>versioning = false<br>recompute_hashes = true<br>debug = true<br><br>[app:grok]<br>use = egg:grokcore.startup#debug<br><br><br>HTH<br><br>--<br>Noe<br><br><div class="gmail_quote">
2012/7/17 Christian Schmidt <span dir="ltr"><<a href="mailto:grok-list@creativenet.de" target="_blank">grok-list@creativenet.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<u></u>
<div bgcolor="#ffffff" text="#000000">
<tt>Hello Group,<br>
<br>
today I ran into problems with static while i followed the tutorial:<br>
<br>
<a href="http://grok.zope.org/doc/current/tutorial.html#static-resources-for-our-web-page" target="_blank">http://grok.zope.org/doc/current/tutorial.html#static-resources-for-our-web-page</a><br>
<br>
I created a static directory, added a styles.css to this directory.
Finally I worte<br>
<br>
<link rel="stylesheet" type="text/css" tal:attributes="href
static/styles.css"><br>
<br>
to my template. Result:<br>
<br>
<b>Line 3, Column 8</b><br>
<b>In expression: <PathExpr standard:u'static/styles.css'></b><br>
- Names:<br>
{'args': (),<br>
'context': <dnszones.app.Dnszones object at 0x808eaab90>,<br>
'default': <object object at 0x800ec4490>,<br>
'loop': {},<br>
'nothing': None,<br>
'options': {},<br>
'repeat': {},<br>
'request': <zope.publisher.browser.BrowserRequest instance URL=<a href="http://127.0.0.1:8080/dnszones/zone" target="_blank">http://127.0.0.1:8080/dnszones/zone</a>>,<br>
'static': None,<br>
'template': <grokcore.view.components.TrustedFilePageTemplate object
at 0x8087245d0>,<br>
'view': <dnszones.app.DnsZonesZone object at 0x809563350>}<br>
<b><br>
- > LocationError: (None, 'styles.css')</b><br>
<br>
Seems that static Directory is not known. Grok book and tutorial
references that
this is done automaticly. Is there a method where i can declare where
the
static resouces can be found - like grok.static('static') in my view or
viewlet?<br>
<big><br>
How to make static resources availabe direct form view or viewlet
template without using fanstatic?<br>
<br>
-<br>
Chris<br>
</big></tt><br>
<br>
</div>
<br>_______________________________________________<br>
Grok-dev mailing list<br>
<a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a href="https://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">https://mail.zope.org/mailman/listinfo/grok-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><span style="color:rgb(255,204,102)">---</span><br>
<span style="color:rgb(204,153,51)">Noe Nieto</span><br>
NNieto Consulting Services<br>
M: <a href="mailto:nnieto@noenieto.com" target="_blank">nnieto@noenieto.com</a><br>
W: <a href="http://noenieto.com" target="_blank">http://noenieto.com</a><br>
T: <a href="https://twitter.com/#%21/tzicatl" target="_blank">@tzicatl</a><br>Li: <a href="http://www.linkedin.com/profile/view?id=84300665" target="_blank">Perfil en LinkedIn</a><br><br>