本文整理汇总了Python中flask_assets.Environment.load_path方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.load_path方法的具体用法?Python Environment.load_path怎么用?Python Environment.load_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_assets.Environment
的用法示例。
在下文中一共展示了Environment.load_path方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_app
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import load_path [as 别名]
def init_app(app):
assets = Environment(app)
styles = Bundle(
'main.scss',
filters='scss',
output='main.css',
depends='**/*.scss'
)
scripts = Bundle(
'*.js',
filters=('slimit'),
output='main.js'
)
assets.register('styles', styles)
assets.register('scripts', scripts)
# TODO: Move this config to an environment file
assets.load_path = ['service/design/styles', 'service/design/scripts']
assets.config['SASS_STYLE'] = 'compressed'
assets.url_expire = False
assets.auto_build = True
示例2: Manager
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import load_path [as 别名]
manager = Manager(app)
manager.add_command("db", MigrateCommand)
# add commands to manage chart cache
from whiskyton.managers.charts import ChartsCommand
manager.add_command("charts", ChartsCommand)
# add command to save analytics data via FTP
from whiskyton.managers.anaytics import AnalyticsCommand
manager.add_command("analytics", AnalyticsCommand)
# enable gzip compression
Compress(app)
# scss
assets = Environment(app)
assets.load_path = [app.config["BASEDIR"].child("whiskyton")]
assets.from_yaml(app.config["BASEDIR"].child("whiskyton", "assets.yaml"))
# log errors
log_handler = StreamHandler()
app.logger.setLevel(logging.DEBUG)
app.logger.addHandler(log_handler)
# register blueprints
from whiskyton.blueprints.site import site
from whiskyton.blueprints.files import files
app.register_blueprint(site)
app.register_blueprint(files)
示例3: original_send
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import load_path [as 别名]
}
}
message.extra_headers = {
'X-SMTPAPI': json.dumps(extra_headers)
}
original_send(message)
app.extensions.get('mail').send = send_email_with_sendgrid
# setup assets
from flask_assets import Environment, Bundle
assets = Environment(app)
assets.url_expire = False
assets.debug = app.debug
# source files
assets.load_path = ['%s/static' % app.config.root_path]
from webassets.filter.pyscss import PyScss
assets.register('css',
Bundle(
'font-awesome-4.7.0/css/font-awesome.min.css',
'chosen/chosen.min.css',
Bundle(
'resources/css/style.scss',
'resources/css/bill-progress.scss',
'resources/css/bootstrap-sortable.css',
filters=PyScss(load_paths=assets.load_path),
output='stylesheets/styles.%(version)s.css'),
output='stylesheets/app.%(version)s.css'))
示例4: import
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import load_path [as 别名]
from flask import (
Flask,
render_template,
send_from_directory,
url_for,
)
from flask_assets import Environment, Bundle
app = Flask(__name__)
assets = Environment(app)
assets.load_path = ['assets', 'bower_components']
assets.from_module('bundle')
@app.route('/')
def root():
return render_template('doge.html')
@app.route('/mikeandjen')
def mikeandjen():
#if False:
# return render_template('loading.html')
#else:
return render_template('mikeandjen.html')
if __name__ == '__main__':
app.run(host='0.0.0.0')
示例5: Flask
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import load_path [as 别名]
from flask import render_template
from flask_assets import Environment, Bundle
root = os.path.dirname(__file__)
app = Flask(__name__)
app.config['ASSETS_DEBUG'] = True
app.config.from_object('settings.default')
app.config.from_object('settings.local')
env = Environment(app)
env.load_path = [
os.path.join(root, 'coffee'),
os.path.join(root, 'static', 'js', 'lib'),
]
env.register('utils', Bundle('utils.coffee', filters='coffeescript', output='c/js/utils.js'))
env.register('objects', Bundle('objects.coffee', filters='coffeescript', output='c/js/objects.js'))
env.register('characters', Bundle('characters.coffee', filters='coffeescript', output='c/js/characters.js'))
env.register('controls', Bundle('controls.coffee', filters='coffeescript', output='c/js/controls.js'))
env.register('globals', Bundle('globals.coffee', filters='coffeescript', output='c/js/globals.js'))
env.register('map', Bundle('map.coffee', filters='coffeescript', output='c/js/map.js'))
env.register('game', Bundle('game.coffee', filters='coffeescript', output='c/js/game.js'))
# env.register(
# 'libs',
# Bundle(
# 'pixi.js',
# 'jquery.min.js',
示例6: Flask
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import load_path [as 别名]
#!/usr/bin/env python
import os
from flask import Flask
from flask import render_template
from flask_assets import Bundle, Environment
from merge_view import show_fixture
from upload import upload, remove
app = Flask(__name__)
assets = Environment(app)
assets.load_path = [
os.path.join(os.path.dirname(__file__), 'node_modules'),
os.path.join(os.path.dirname(__file__), 'static')
]
main_js = Bundle(
'angular/angular.min.js',
'angular-sanitize/angular-sanitize.min.js')
main_css = Bundle(
'bootstrap/dist/css/bootstrap.min.css')
viewer_js = Bundle(
'angular-object-diff/dist/angular-object-diff.min.js',
'app.js')
viewer_css = Bundle(
'angular-object-diff/dist/angular-object-diff.css')
upload_js = Bundle('upload.js')
assets.register('main_js', main_js)
assets.register('main_css', main_css)