On May 25, 5:16 pm, Wyatt Baldwin <[email protected]> wrote:
> On Wednesday, May 25, 2011 5:51:15 AM UTC-7, Geoff wrote:
>
>
> In your templates, use the `pylons.url` function to generate URLs:
>
> ${url('/css/blah.css')}
>
> Pass the app prefix through to your JS, perhaps like this:
>
> <script>
> my_namespace.app_prefix = '${url("/")}';
> var url = [my_namespace.app_prefix, '/some/path'].join('/'); // maybe
> create a utility function for this
> </script>
>
Unfortunately I have not found a way to put one expression
substitution inside another and my templates have this sort of thing:
${h.stylesheet_link('/css/main.css')}
It would be nice to do this:
${h.stylesheet_link(${url('/css/main.css')})}
but, alas, this doesn't work.
Also my js files are separate from the template so the url function
isn't available.
> If you are running your app behind a proxy, you will need to use something
> like Paste's PrefixMiddleware.
This is the answer! As described at
http://pythonpaste.org/deploy/modules/config.html
I have added the prefix filter to development.ini and now I can prefix
all my static paths with the appropriate string. As long as I do not
carry this over to production.ini then it should work fine.
Thanks both.
--
Geoff
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.