Skip to content

Instantly share code, notes, and snippets.

@patrickkettner
Created March 18, 2013 17:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickkettner/5189012 to your computer and use it in GitHub Desktop.
Save patrickkettner/5189012 to your computer and use it in GitHub Desktop.
bottle (python web framework) serve nested static files
"""
I don't know why, but this took me forever to figure out.
you just need to match .* and then serve it out of a root folder
with a matching file structure to the request.
leaving this here for the next time I need to roll something from scratch
"""
@route('/static/<filename:re:.*>')
def server_static(filename):
return static_file(filename, root='./static')
@Baboskence
Copy link

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment