On Dec 2, 2011, at 7:41 AM, monotasker wrote:

> It resolves to 
> http://127.0.0.1:8000/topoi/plugin_listandedit/list/notes/static/plugin_framework/fonts/websymbols-regular-webfont.woff
> 
> This is treating the font url as relative to the full request URL (including 
> arguments), not the app root directory. That's what's confusing me.

This is when your url is 'static/...', right? That's normal behavior, and 
nothing to do with web2py. The browser knows that it accessed 
http://127.0.0.1:8000/topoi/plugin_listandedit/list/notes and all relative URLs 
are relative to that path. The browser knows nothing about how elements of the 
path are interpreted by the server; a path is a path.

To summarize, what you want is this:

>  
> http://127.0.0.1:8000/topoi/static/plugin_framework/fonts/websymbols-regular-webfont.woff

but without specifying 'topoi', because you want it appname-independent, right?

One option is the <base> tag (generated dynamically via a template, so you 
don't type the appname literally):

        <base href="/topoi/" />

The problem is that it applies to *all* relative URLs, so make sure you take 
that into account. Fortunately the URL() helper always generates absolute URLs.

Another option is to server your CSS files dynamically via a css controller. 
Depending on your application, the performance hit needn't be too bad if you 
make sure that the generated pages are cached by the browser. This is a handy 
technique, because it lets you parameterize anything you like in your CSS.

Reply via email to