def static_resources(config):
from pkg_resources import resource_filename
import mimetypes
mimetypes.init()
mimetypes.init([resource_filename('snowflakes', 'static/mime.types')])
config.add_static_view('static', 'static', cache_max_age=STATIC_MAX_AGE)
config.add_static_view('profiles', 'schemas', 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')
评论列表
文章目录