Question

In Pylons I have a mako template linking to /static/resource.css. How do I automatically link to /pylons/static/resource.css when I decide to map the application to a subdirectory on my web server?

Was it helpful?

Solution

If you want your static file links to be relative to your app root, wrap them like this in your templates (assuming Mako and Pylons 0.9.7):

${url('/static/resource.css')}

The root path of your app will be prepended. No need to define specific routes for each file.

OTHER TIPS

What you want are static routes:

map.connect('resource', '/static/resource.css', _static=True)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top