当前位置: 首页>>代码示例>>Python>>正文


Python Environment.cache方法代码示例

本文整理汇总了Python中flask_assets.Environment.cache方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.cache方法的具体用法?Python Environment.cache怎么用?Python Environment.cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_assets.Environment的用法示例。


在下文中一共展示了Environment.cache方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init_app(app):
    webassets = Environment(app)
    webassets.register('css_all', css_all)
    webassets.register('js_vendor', js_vendor)
    webassets.manifest = 'cache' if not app.debug else False
    webassets.cache = not app.debug
    webassets.debug = app.debug
开发者ID:OpenCode,项目名称:manekineko,代码行数:9,代码来源:assets.py

示例2: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
 def init_app(self, app):
     env = Environment(app)
     env.url_expire = True
     env.register('css_app', css_app)
     env.register('js_app', js_app)
     env.manifest = 'cache' if not app.debug else False
     env.cache = not app.debug
     env.debug = app.debug
开发者ID:ak04nv,项目名称:flask-bootstrap,代码行数:10,代码来源:assets.py

示例3: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init_app(app):
    assets = Environment(app)
    assets.register("css_vendor", css_vendor)
    assets.register("js_vendor", js_vendor)
    assets.register("css_linkedlist", css_linkedlist)
    assets.manifest = 'cache' if not app.debug else False
    assets.cache = not app.debug
    assets.debug = app.debug
开发者ID:rthome,项目名称:LinkedList,代码行数:10,代码来源:assets.py

示例4: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init_app(app):
    webassets = Environment(app)
    webassets.url = app.static_url_path
    webassets.register('js_lodjers', js_lodjers)
    webassets.register('js_mixpanel', js_mixpanel)
    webassets.register('css_lodjers', css_lodjers)
    webassets.manifest = 'cache' if not app.debug else False
    webassets.cache = not app.debug
    webassets.debug = app.debug
开发者ID:alexgerstein,项目名称:dartmouth-roommates,代码行数:11,代码来源:assets.py

示例5: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init_app(app):
    """
    Initilize assets.
    :param app:
    """
    webassets = Environment(app)
    webassets.url = app.static_url_path
    webassets.register('css_all', css_all)
    webassets.manifest = 'cache' if not app.debug else False
    webassets.cache = not app.debug
    webassets.debug = app.debug
开发者ID:iepathos,项目名称:flask-canjs-i18n-boilerplate,代码行数:13,代码来源:assets.py

示例6: prepare

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def prepare(app):
    web_assets = Environment(app)

    web_assets.register('css_all', *prepare_css())
    web_assets.register('js_all', *prepare_js())

    is_debugging = app.debug
    web_assets.manifest = 'cache' if not is_debugging else False
    web_assets.cache = not is_debugging
    web_assets.debug = is_debugging

    return app
开发者ID:richdouglasevans,项目名称:hipflask,代码行数:14,代码来源:assets.py

示例7: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init_app(app):
    webassets = Environment(app)

    webassets.register('css_bootstrap', css_bootstrap)
    #webassets.register('css_local', css_local)

    #webassets.register('js_local', js_local)
    #webassets.register('js_jquery', js_jquery)
    webassets.register('js_bootstrap', js_bootstrap)
    #webassets.register('js_angular', js_angular)
    #webassets.register('js_coffee', js_coffee)

    webassets.manifest = 'cache' if not app.debug else False
    webassets.cache = not app.debug
    webassets.debug = app.debug
开发者ID:alexsavio,项目名称:SandS-EDB,代码行数:17,代码来源:assets.py

示例8: init_app

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init_app(app):
    debug = app.debug
    webassets = Environment(app)
    # add foundation sass files to sass compiler paths
    webassets.config['SASS_LOAD_PATHS'] = ["../bower_components/foundation/scss/",
                                           "."]

    webassets.register('css_kb', css_kb)
    webassets.register('shivs', shivs)
    webassets.register('js_vendor', js_vendor)
    webassets.register('js_main', js_main)


    webassets.manifest = 'cache' if not debug else False
    webassets.cache = not debug
    webassets.debug = debug
开发者ID:felix1m,项目名称:knowledge-base,代码行数:18,代码来源:assets.py

示例9: init

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
def init(app) -> None:
    """
    Bundle projects assets.

    :param app: Main application instance
    :type app: flask.Flask
    """
    assets = Environment(app)
    assets.auto_build = app.config.get('ASSETS_AUTO_BUILD', True)
    files_to_watch = []

    if 'COLLECT_STATIC_ROOT' in app.config:
        assets.cache = app.config['COLLECT_STATIC_ROOT']
        collect = Collect()
        collect.init_app(app)
        collect.collect()
        app.static_folder = app.config['COLLECT_STATIC_ROOT']

    for key in ['js', 'css']:
        assets_key = '%s_ASSETS' % key.upper()
        build_files = app.config[assets_key]

        files_to_watch.extend(_get_files_for_settings(app, assets_key))

        bundle = Bundle(*build_files,
                        output=app.config['%s_OUTPUT' % assets_key],
                        filters=app.config['%s_FILTERS' % assets_key]
                        )

        assets.register('%s_all' % key, bundle)

        app.logger.debug('Bundling files: %s%s',
                         os.linesep,
                         os.linesep.join(build_files))

    app.assets = assets
    app._base_files_to_watch = files_to_watch

    app.logger.info('Base assets are collected successfully.')
开发者ID:mrgambal,项目名称:vulyk,代码行数:41,代码来源:_assets.py

示例10: Bundle

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
    'tendril_css': Bundle(
        'css/tendril.css',
        output='gen/tendril.css',
        filters='cssmin'
    ),

    'nvd3_js': Bundle(
        'js/d3/d3.js',
        'js/d3/nv.d3.js',
        output='gen/nv.d3.js',
        filters='jsmin'
    ),

    'nvd3_css': Bundle(
        'css/nv.d3.css',
        output='gen/nv.d3.css',
        filters='cssmin'
    ),

    'mixer_js': Bundle(
        'js/mixer.js',
        output='gen/tendril.js',
        filters='jsmin',
    )
}


assets = Environment(app)
assets.cache = os.path.join(INSTANCE_CACHE, 'flaskassetcache')
assets.register(bundles)
开发者ID:chintal,项目名称:tendril,代码行数:32,代码来源:assets.py

示例11: SQLAlchemy

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
])
app.jinja_loader = my_loader

db = SQLAlchemy(app)

Markdown(app, extensions=['footnotes'])
pages = FlatPages(app)

manager = Manager(app)

# Scss
assets = Environment(app)
assets.url_expire = True
assets.auto_build = True
assets.append_path('sni/assets')
assets.cache = 'sni/assets/.webassets-cache'

scss = Bundle('scss/__main__.scss', filters='pyscss', output='css/main.css',
              depends=['scss/*.scss'])
assets.register('scss_all', scss)

assets.debug = False
app.config['ASSETS_DEBUG'] = False

cache = Cache(app, config={'CACHE_TYPE': 'simple'})

if not app.debug:
    import logging
    from logging.handlers import RotatingFileHandler
    file_handler = RotatingFileHandler('tmp/snilog.csv',
                                       'a',
开发者ID:NakamotoInstitute,项目名称:nakamotoinstitute.org,代码行数:33,代码来源:__init__.py

示例12: Flask

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
FLATPAGES_AUTO_RELOAD = DEBUG
FLATPAGES_EXTENSION = '.md'
# LESS_BIN = os.path.join(SCRIPT_ROOT, '..', 'node_modules', 'less', 'bin', 'lessc')
LESS_LINE_NUMBERS = 'mediaquery'
FREEZER_DESTINATION = os.path.join(SITE_ROOT, '..', '..', 'build')
FLATPAGES_ROOT = os.path.join(SITE_ROOT, '..', '..', 'pages')

app = Flask(
    import_name='codingnotes',
    static_folder=os.path.join(SITE_ROOT, '..', '..', 'static'),
    template_folder=os.path.join(SITE_ROOT, '..', '..', 'templates'),
)

assets = Environment(app)
assets.manifest = False
assets.cache = False
if DEBUG:
    assets.manifest = False
    assets.cache = None
freezer = Freezer(app)
pages_on_disk = FlatPages(app)

app.config.from_object(__name__)


def is_published(post_date):
    return utc.localize(datetime.utcnow()) >= utc.localize(datetime.combine(post_date, time(0, 0, 0)))
published_pages = sorted([p for p in pages_on_disk if is_published(p.meta.get('date', '2099-12-31'))], key=lambda p: p.meta['date'])


def get_latest_pages(limit=10):
开发者ID:malandro95,项目名称:codingnot.es,代码行数:33,代码来源:application.py

示例13: Flask

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
FLATPAGES_EXTENSION = '.md'
# LESS_BIN = os.path.join(SCRIPT_ROOT, '..', 'node_modules', 'less', 'bin', 'lessc')
LESS_LINE_NUMBERS = 'mediaquery'
FREEZER_DESTINATION = os.path.join(SITE_ROOT, '..', '..', 'build')
FLATPAGES_ROOT = os.path.join(SITE_ROOT, '..', '..', 'pages')

app = Flask(
    import_name='codingnotes',
    static_folder=os.path.join(SITE_ROOT, '..', '..', 'static'),
    template_folder=os.path.join(SITE_ROOT, '..', '..', 'templates'),
)

assets = Environment(app)
assets.debug = DEBUG
assets.manifest = None
assets.cache = None
freezer = Freezer(app)
pages_on_disk = FlatPages(app)

app.config.from_object(__name__)


def is_published(post_date):
    return utc.localize(datetime.utcnow()) >= utc.localize(datetime.combine(post_date, time(0, 0, 0)))
published_pages = sorted([p for p in pages_on_disk if is_published(p.meta.get('date', '2099-12-31'))], key=lambda p: p.meta['date'])


def get_latest_pages(limit=10):
    pages = published_pages if not request.args.get('preview') else pages_on_disk
    # Articles are pages with a publication date
    articles = (p for p in pages if 'date' in p.meta)
开发者ID:riccardo-forina,项目名称:codingnot.es,代码行数:33,代码来源:application.py

示例14: Flask

# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import cache [as 别名]
from flask import Flask, render_template
from flask_assets import Environment, Bundle
from flask_frozen import Freezer


SITE_ROOT = os.path.dirname(os.path.realpath(__file__))

app = Flask(
    import_name=__name__,
    static_folder=os.path.join(SITE_ROOT, '..', '..', 'static'),
    template_folder=os.path.join(SITE_ROOT, '..', '..', 'templates'),
)

assets = Environment(app)
assets.manifest = False
assets.cache = False
assets.debug = True

freezer = Freezer(app)

app.config.update(
    DEBUG=True,
    FREEZER_DESTINATION=os.path.join(SITE_ROOT, '..', '..', 'build')
)


assets.register('js_all', Bundle(
    'js/website.js',
    filters='jsmin',
    output='build/website.js'
))
开发者ID:giacomozinetti,项目名称:html-howto,代码行数:33,代码来源:application.py


注:本文中的flask_assets.Environment.cache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。