[Grok-dev] Static Resources

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed Sep 21 02:49:33 EST 2011

On 9/21/11 09:11 , Alexandre Garel wrote:
> Le 19/09/2011 15:11, paul a écrit :
>> Hi, Jan,
>> I think Noe's answer "sorta" helped. The problem with doing it through
>> resource.need(), is that for a favicon.ico, the link header should be
>> something like:
>> <link rel="SHORTCUT ICON"type="image/x-icon"href="path to .ico file" />
>> If you just use resource.need(), you get the href bit right, but the
>> "rel=" and "type=" parts are not right. I eventually settled for doing:
>> <link rel="SHORTCUT
>> ICON"type="image/x-icon"href="@@/fanstatic/appname/favico.ico" />
>> Which seems to work ok.
> Here, using fanstatic 0.11.2, the ".ico" of the ressource make it
> recognized as a favicon and fanstatic automatically represent it with :
> <link  rel="shortcut icon"type="image/x-icon"href="xxxxx  <view-source:http://localhost:8081/fanstatic/vigirisk_library/:version:2011-09-12T11:00:54.09/favicon.ico>"/>
> It's done by function render_ico in core.py registere for '.ico'

And, in addition to this answer, it is not very difficult to plugin your 
own renderer for specific types of resources. Something like this:

   from fanstatic import Library, Resource

   library = Library('entrypointname', 'dirname')

   def render_apple_touch_icon(url):
     return '<link rel="apple-touch-icon" href="%s" />' % url

   apple_touch_icon = Resource(

regards, jw

More information about the Grok-dev mailing list