Skip to content

Instantly share code, notes, and snippets.

@lrowe
Created March 18, 2013 21:53
Show Gist options
  • Save lrowe/5191160 to your computer and use it in GitHub Desktop.
Save lrowe/5191160 to your computer and use it in GitHub Desktop.
favicon subrequest for pyramid
def static_resources(config):
config.add_static_view('static', 'static', cache_max_age=STATIC_MAX_AGE)
favicon_path = '/static/img/favicon.ico'
if config.route_prefix:
favicon_path = '/%s%s' % (config.route_prefix, favicon_path)
config.add_route('favicon.ico', 'favicon.ico')
def favicon(request):
subreq = request.copy()
subreq.path_info = favicon_path
response = request.invoke_subrequest(subreq)
return response
config.add_view(favicon, route_name='favicon.ico')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment