本文整理汇总了Python中flask_assets.Environment.url_expire方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.url_expire方法的具体用法?Python Environment.url_expire怎么用?Python Environment.url_expire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_assets.Environment
的用法示例。
在下文中一共展示了Environment.url_expire方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_app
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import url_expire [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
示例2: create_app
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import url_expire [as 别名]
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(config[config_name])
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
# not using sqlalchemy event system, hence disabling it
config[config_name].init_app(app)
# Set up extensions
mail.init_app(app)
db.init_app(app)
login_manager.init_app(app)
csrf.init_app(app)
compress.init_app(app)
RQ(app)
# Register Jinja template functions
from .utils import register_template_utils
register_template_utils(app)
# Set up asset pipeline
assets_env = Environment(app)
dirs = ['assets/styles', 'assets/scripts']
for path in dirs:
assets_env.append_path(os.path.join(basedir, path))
assets_env.url_expire = True
assets_env.register('app_css', app_css)
assets_env.register('app_js', app_js)
assets_env.register('vendor_css', vendor_css)
assets_env.register('vendor_js', vendor_js)
# Configure SSL if platform supports it
if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
from flask.ext.sslify import SSLify
SSLify(app)
# Create app blueprints
from .main import main as main_blueprint
app.register_blueprint(main_blueprint)
from .account import account as account_blueprint
app.register_blueprint(account_blueprint, url_prefix='/account')
from .admin import admin as admin_blueprint
app.register_blueprint(admin_blueprint, url_prefix='/admin')
from .participant import participant as participant_blueprint
app.register_blueprint(participant_blueprint, url_prefix='/participant')
return app
示例3: init_app
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import url_expire [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
示例4: original_send
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import url_expire [as 别名]
"utm_campaign": "user-account"
}
}
}
}
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),
示例5: SQLAlchemy
# 需要导入模块: from flask_assets import Environment [as 别名]
# 或者: from flask_assets.Environment import url_expire [as 别名]
'sni/templates/blog/',
'sni/templates/docs/',
'sni/templates/podcast/']),
])
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