本文整理汇总了Python中aspen.website.Website.compress_assets方法的典型用法代码示例。如果您正苦于以下问题:Python Website.compress_assets方法的具体用法?Python Website.compress_assets怎么用?Python Website.compress_assets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aspen.website.Website
的用法示例。
在下文中一共展示了Website.compress_assets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_nav_next_to_context
# 需要导入模块: from aspen.website import Website [as 别名]
# 或者: from aspen.website.Website import compress_assets [as 别名]
def add_nav_next_to_context(nav_current, website):
return {'nav_next': nav_current.next_child}
def only_allow_certain_methods(request):
whitelisted = ['GET', 'HEAD', 'POST']
if request.method.upper() not in whitelisted:
raise Response(405)
website.algorithm.insert_before('dispatch_request_to_filesystem', only_allow_certain_methods)
website.algorithm.insert_after('dispatch_request_to_filesystem', add_nav_to_website)
website.algorithm.insert_after('add_nav_to_website', add_nav_current_to_context)
website.algorithm.insert_after('add_nav_current_to_context', add_nav_next_to_context)
# Set website.version.
# ====================
# Yeesh, what a hack. At Heroku we don't have a git repo once deployed, so
# instead of using a git SHA we're going to just use a random string. Doing
# this "right" would mean storing the real version SHA somewhere during
# deployment.
website.version = ''.join([random.choice(string.letters) for i in range(32)])
# Set random thing that we're not really using.
# =============================================
website.compress_assets = False # If set to True, the responsiveness on the lower
# homepage breaks. :-/