On Nov 24, 10:30 am, jon <[email protected]> wrote:
> Hi,
>
> I'm wondering if it's possible to put CSS, images and JavaScript into
> the /template directory of Pylons and somehow get the Mako templates
> to refer to those files and not the ones in /public?
>
> I'm building a system which is "themeable" and I want to keep all of
> the theme files together and figured a structure like this would work
> best:
>
> /templates/themes/mytheme
>                                          /css
>                                          /js
>                                          /img
>                                          base.mako
>                                          layout1.mako
>                                          layout2.mako
>
> Thoughts on this? Is there a better way?

Maybe put the static files in a subdirectory so that you can change
the config value that says where Pylons should look for static files?

/templates/themes/mytheme
                                         /static/css
                                                  /js
                                                  /img
                                         base.mako
                                         layout1.mako
                                         layout2.mako

In your middleware, there should be some lines like this:

    public_dir = config['pylons.paths']['static_files']
    static_app = StaticURLParser(public_dir, cache_max_age=43200)

Instead of getting the public_dir value from 'pylons.paths', which is
hardcoded in environment.py, you could set it in a config file.

One thing I'm curious about is whether it is possible to dynamically
change the StaticURLParser's public_dir location, or would you have to
restart the app?

--

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.


Reply via email to