def assets_env(app): env = Environment(app) env.url = "/static" # App Engine doesn't support automatic rebuilding. env.auto_build = False # This file needs to be shipped with your code. env.manifest = ('file:' + os.path.join(root_dir, 'webassets.manifest')) env.versions = 'hash:32' # create static bundles env.register('new_js', 'js/hiro.js', filters='yui_js', output="javascript/hiro.%(version)s.js") env.register('hoc_js', 'js/hoc.js', filters='yui_js', output="javascript/hoc.%(version)s.js") env.register('new_css', 'css/hiro.css', filters='cssmin', output="stylesheets/hiro.%(version)s.css") env.register('hoc_css', 'css/hoc.css', filters='cssmin', output="stylesheets/hoc.%(version)s.css") env.debug = app.config['DEBUG'] return env
def init_app(app): webassets = Environment(app) webassets.register("apollo_css", apollo_css) webassets.register("apollo_js", apollo_js) webassets.manifest = "cache" if not app.debug else False webassets.cache = not app.debug webassets.debug = app.debug
def init_app(app): webassets = Environment(app) webassets.register('apollo_css', apollo_css) webassets.register('apollo_js', apollo_js) webassets.manifest = 'cache' if not app.debug else False webassets.cache = not app.debug webassets.debug = app.debug
def init_app(app): webassets = Environment(app) webassets.register('css_all', css_all) webassets.register('js_vendor', js_vendor) webassets.register('js_ie', js_ie) webassets.register('js_main', js_main) webassets.manifest = 'cache' if not app.debug else False webassets.cache = not app.debug webassets.debug = app.debug
def configure_static_assets(app): loader = YAMLLoader('assets.yaml') assets = Environment(app) assets.manifest = None assets.cache = False assets.directory = './makers' assets.url = '' for name, bundle in loader.load_bundles().items(): assets.register(name, bundle) app.environment = assets
def setup_bundles(app): assets_env = Environment(app) assets_env.url = '/statics' assets_env.manifest = 'file:Compiled/static-manifest-version' assets_env.cache = False assets_env.auto_build = False assets_env.debug = app.config.get('DEVELOPMENT') == True # load and register bundles config_path = app.instance_path + '/config/asset_bundles.yaml' bundles = YAMLLoader(config_path).load_bundles() for name, bundle in bundles.iteritems(): assets_env.register(name, bundle) app.assets_env = assets_env
def register_assets(app, debug=False): """We add the app's root path to assets search path. However, the output directory is relative to `app.static_folder`. """ assets = Environment(app) assets.debug = debug assets.auto_build = True assets.manifest = 'file' assets.append_path(app.root_path) site_js = Bundle( 'static/app.js', filters=('uglifyjs',), output='js/bundle.js' ) assets.register('site_js', site_js) site_css = Bundle( 'static/style.css', filters=('cssmin',), output='css/bundle.css' ) assets.register('site_css', site_css)
from apps.shared.models import db db.init_app(app) # load configs app.config.from_pyfile('config/default.cfg') # dev config will override anything set on line above if os.getenv('DEV_CONFIGURATION'): app.config.from_envvar('DEV_CONFIGURATION') # attach assets assets = Environment(app) assets.versions = 'hash' assets.url = app.static_url_path manifest_path = os.path.realpath( os.path.join(os.path.dirname(__file__), '.static-manifest')) assets.manifest = 'file://%s' % manifest_path bundles = YAMLLoader(os.path.realpath( os.path.join(os.path.dirname(__file__), 'assets.yml'))).load_bundles() for bundle_name, bundle in bundles.items(): assets.register(bundle_name, bundle) # set up logging if not app.debug: log_format = logging.Formatter(""" --- Message type: %(levelname)s Location: %(pathname)s:%(lineno)d Module: %(module)s Time: %(asctime)s %(message)s
) from modules.log import initialize initialize() application = Flask( __name__, static_folder=join(abspath(dirname(__file__)), 'resources'), ) application.config.from_pyfile('settings.py') assets = Environment(application) assets.cache = not application.config['DEBUG'] assets.debug = application.config['DEBUG'] assets.directory = application.static_folder assets.manifest = 'json:assets/versions.json' assets.url = application.static_url_path assets.url_expire = True assets.versions = 'hash' assets.register('javascripts', Bundle( 'vendor/jquery/dist/jquery.js', 'vendor/angular/angular.min.js', 'vendor/bootstrap/dist/js/bootstrap.js', 'vendor/highcharts/highcharts-all.js', 'javascripts/all.js', filters='rjsmin' if not application.config['DEBUG'] else None, output='assets/compressed.js', )) assets.register('stylesheets', Bundle( Bundle( 'stylesheets/all.less', filters='less', output='stylesheets/all.css',
application = Flask(__name__, static_folder=join(abspath(dirname(__file__)), 'resources')) application.config.from_pyfile('settings/__init__.py') application.config.from_pyfile( 'settings/%(environment)s.py' % { 'environment': environ.get('environment', 'serve'), }, silent=True) assets = Environment(application) assets.cache = False assets.debug = application.config['DEBUG'] assets.directory = application.static_folder assets.manifest = 'json:assets/versions.json' assets.url = application.static_url_path assets.url_expire = True assets.versions = 'hash' assets.register( 'javascripts', Bundle( 'vendor/jquery/dist/jquery.js', 'vendor/bootstrap/dist/js/bootstrap.js', filters='rjsmin' if not application.config['DEBUG'] else None, output='assets/compressed.js', )) assets.register( 'stylesheets', Bundle( Bundle(
except Exception, e: auctions_server.logger.warning( "Error on request to {} with msg {}".format(request.url, e) ) auctions_server.proxy_mappings.expire(str(self.auction_doc_id), 0) return NotFound()(environ, start_response) auctions_server = Flask( __name__, static_url_path='', template_folder='templates' ) ################################################################################ assets = Environment(auctions_server) assets.manifest = "json:manifest.json" css = Bundle("vendor/angular-growl-2/build/angular-growl.min.css", "static/css/starter-template.css", filters='cssmin,datauri', output='min/styles_%(version)s.css') assets.register('all_css', css) js = Bundle("vendor/event-source-polyfill/eventsource.min.js", "vendor/angular-cookies/angular-cookies.min.js", "vendor/angular-ellipses/src/truncate.js", "vendor/angular-timer/dist/angular-timer.min.js", "vendor/angular-translate/angular-translate.min.js", "vendor/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js", "vendor/angular-translate-storage-local/angular-translate-storage-local.min.js", "vendor/angular-growl-2/build/angular-growl.js", "static/js/app.js",
self.add_event_source(stream_response) return stream_response except Exception, e: auctions_server.logger.warning( "Error on request to {} with msg {}".format(request.url, e)) auctions_server.proxy_mappings.expire(str(self.auction_doc_id), 0) return NotFound()(environ, start_response) auctions_server = Flask(__name__, static_url_path='', template_folder='templates') ################################################################################ assets = Environment(auctions_server) assets.manifest = "json:manifest.json" css = Bundle("vendor/angular-growl-2/build/angular-growl.min.css", "static/css/starter-template.css", filters='cssmin,datauri', output='min/styles_%(version)s.css') assets.register('all_css', css) js = Bundle( "vendor/pouchdb/dist/pouchdb.js", "vendor/event-source-polyfill/eventsource.min.js", "vendor/angular-cookies/angular-cookies.min.js", "vendor/angular-ellipses/src/truncate.js", "vendor/angular-timer/dist/angular-timer.min.js", "vendor/angular-translate/angular-translate.min.js", "vendor/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js", "vendor/angular-translate-storage-local/angular-translate-storage-local.min.js",
app.jinja_loader = FileSystemLoader( os.path.join(base_dir, 'static', 'templates')) app.config.from_object('config') app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI db = SQLAlchemy(app) lm = LoginManager() lm.init_app(app) lm.login_view = 'login' lm.login_message = 'Please log in to access this page.' mail = Mail(app) CsrfProtect(app) assets = Environment(app) assets.cache = False assets.manifest = "json:{path}" appcss = Bundle('css/fix.css', 'css/custom.css', 'css/fonts.css', filters='cssmin', output='gen/app.css') assets.register('css_app', appcss) appjs = Bundle('js/data.js', 'js/main.js', filters='jsmin', output='gen/app.js') libsjs = Bundle('js/_libs/jquery/jquery-2.2.0.min.js', 'js/_libs/nunjucks.min.js', 'js/_libs/canvas-to-blob.min.js',
'db1': app.config['SQLALCHEMY_DATABASE_URI'], } root_path = os.path.abspath("%s/.." % os.path.dirname(__file__)) tmp_path = "%s/tmp" % root_path os.environ['BOTO_ENDPOINTS'] = os.path.abspath( "%s/config/boto_endpoints.json" % root_path) ################### # ASSETS SETTINGS # ################### assets = Environment(app) loader = YAMLLoader("%s/assets/assets.yml" % root_path) bundles = loader.load_bundles() assets.register(bundles) assets.set_directory("%s/public" % root_path) assets.load_path.append('./assets/') assets.url = '/' assets.manifest = "json:%s/public/gen/webassets-manifest.json" % root_path development_mode = not environment.equals('production') assets.cache = development_mode assets.auto_build = development_mode assets.debug = development_mode # MD Feb-2015 Allow created files to be group writeable. This will fix some problems with files created in the /tmp # directory that are accessed both by Celery and duesty scripts. The /tmp directory should have set "chmod g+s tmp" os.umask(0o002)
Website for the Queen's Global Innovation Conference (2013) blah blah blah """ from flask import Flask, render_template, url_for from flask.ext.assets import Environment, Bundle app = Flask(__name__) assets = Environment(app) assets.url = '/static' # HACK HACK HACK assets.auto_build = False assets.debug = False assets.manifest = "file:assets-manifest" assets.register('css_screen', 'sass/screen.sass', filters='compass', output='css/screen.%(version)s.css') assets.register('css_print', 'sass/print.sass', filters='compass', output='css/print.%(version)s.css') assets.register('js', 'coffee/main.coffee', filters='coffeescript', output='js/main.%(version)s.js')
from flask_sslify import SSLify from bucketier import Bucketier app = Flask(__name__) app.debug = os.environ.get('ENV', 'development') == 'development' app.secret_key = os.environ.get('SECRET_KEY') or "Set a secret key plz" app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 315576000 SSLify(app) # Assets assets = Environment(app) assets.url = "/static/" assets.manifest = "file" assets.debug = app.debug assets.auto_buid = app.debug assets.config['compass_plugins'] = ['bootstrap-sass'] assets.register('js', 'http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js', 'http://cdnjs.cloudflare.com/ajax/libs/jquery.form/3.24/jquery.form.js', 'http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.0/js/bootstrap.min.js', Bundle('js/app.coffee', filters='coffeescript', output='gen/app.js'), filters='closure_js', output='gen/app-%(version)s.js') assets.register('css', 'css/app.scss', filters='compass,cssmin', output='gen/app-%(version)s.css') # Helpers
try: app.config.from_pyfile('config/sensitive.py') except IOError: pass if os.getenv('SPAMSUB_CONFIGURATION'): app.config.from_envvar('SPAMSUB_CONFIGURATION') # attach assets assets = Environment(app) assets.versions = 'hash' manifest_path = os.path.realpath( os.path.join(os.path.dirname(__file__), '.static-manifest')) assets.manifest = 'file://%s' % manifest_path bundles = YAMLLoader(os.path.realpath( os.path.join(os.path.dirname(__file__), 'assets.yml'))).load_bundles() for bundle_name, bundle in bundles.items(): assets.register(bundle_name, bundle) ## import our own blueprints here if necessary # from apps.foo.views import foo_app # attach any blueprints # app.register_blueprint(foo_app, url_prefix='/foo') # Error handling @app.errorhandler(404)
from os.path import dirname, join, realpath, normpath from flask.ext.assets import Environment, Bundle from app import app environment = Environment(app) environment.versions = 'hash' manifest_path = normpath(realpath(join(dirname(__file__), '.static-manifest'))) environment.manifest = 'file:%s' % manifest_path environment.cache = False environment.debug = False css_main = Bundle( 'css/main.css', Bundle('less/main.less', filters='less'), filters='cssmin', output='css/main.%(version)s.css' ) js_head = Bundle( 'https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js', output='js/head.%(version)s.js' ) js_foot = Bundle( 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js', Bundle( 'js/scripts.js',
Website for the Queen's Global Innovation Conference (2013) blah blah blah """ from flask import Flask, render_template, url_for from flask.ext.assets import Environment, Bundle app = Flask(__name__) assets = Environment(app) assets.url = '/static' # HACK HACK HACK assets.auto_build = False assets.debug = False assets.manifest = "file:assets-manifest" assets.register('css_screen', 'sass/screen.sass', filters='compass', output='css/screen.%(version)s.css') assets.register('css_print', 'sass/print.sass', filters='compass', output='css/print.%(version)s.css') assets.register('js', 'coffee/main.coffee', filters='coffeescript', output='js/main.%(version)s.js') @app.route('/') def home(): team_members = [ { 'name': 'Olga Khuskivadse',
from flask.ext.assets import Environment, Bundle from flask.ext.sqlalchemy import SQLAlchemy from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from flask_wtf.csrf import CsrfProtect import wtforms_json app = Flask(__name__) CsrfProtect(app) wtforms_json.init() app.config.from_object('config') manager = Manager(app) assets = Environment(app); assets.cache = False assets.manifest = "file:assets_manifest" css = Bundle('scss/materialize.scss', filters='pyscss', output='css/all.css') assets.register('all_css', css) js = Bundle('js/*', filters='jsmin', output='js/all.js') assets.register('all_js', js) db = SQLAlchemy(app) migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) if __name__ == "__main__": manager.run() from app import views, models
app.register_blueprint(userprofile.views.bp) app.secret_key = SECRET_KEY app.mail = Mail(app) core.cache.init_app(app) logbook = Logbook(app) try: from flask.ext.debugtoolbar import DebugToolbarExtension toolbar = DebugToolbarExtension(app) except ImportError: pass assets = Environment(app) assets.cache = False assets.manifest = 'file:' import envoy def stylus(_in, out, **kwargs): result = envoy.run('stylus --include /home/vagrant/osbench/workbench/stylus-nib/0.8.1/node_modules/nib/lib', data=_in.read()) out.write(result.std_out) css = Bundle('less/site.less', filters=['less'], output='css/site.css') css_stylus = Bundle('stylus/site.styl', filters=[stylus], output='css/stylus.css') assets.register('css_all', css) assets.register('css_stylus', css_stylus) js = Bundle('coffee/site.coffee', filters=['coffeescript'], output='js/site.js') assets.register('js_all', js)
__author__ = 'hsk81' ############################################################################### ############################################################################### from flask.ext.assets import Environment from webassets.loaders import YAMLLoader from ..app import app ############################################################################### ############################################################################### loader = YAMLLoader(app.config['YML_FILE']) bundles = loader.load_bundles() assets = Environment(app) assets.manifest = 'cache' assets.register(bundles) assets.url = app.config.get('CDN') ############################################################################### ###############################################################################
app.jinja_loader = FileSystemLoader(os.path.join(base_dir, 'static', 'templates')) app.config.from_object('config') app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI db = SQLAlchemy(app) lm = LoginManager() lm.init_app(app) lm.login_view = 'login' lm.login_message = 'Please log in to access this page.' mail = Mail(app) CsrfProtect(app) assets = Environment(app) assets.cache = False assets.manifest = "json:{path}" appcss = Bundle('css/fix.css', 'css/custom.css', 'css/navbar.css', 'css/fonts.css', 'css/font-awesome.min.css', filters='cssmin', output='gen/app.css') assets.register('css_app', appcss) appjs = Bundle('js/data.js', 'js/app.js', 'js/navbar.js', filters='jsmin', output='gen/app.js') libsjs = Bundle('js/_libs/jquery/jquery-2.2.0.min.js', 'js/_libs/nunjucks.min.js', 'js/_libs/canvas-to-blob.min.js', 'js/_libs/load-image.all.min.js', 'js/_libs/backbone/underscore-min.js', 'js/_libs/backbone/backbone-min.js', 'js/_libs/backbone/backbone.localStorage-min.js', filters='jsmin', output='gen/libs.js') assets.register('js_app', appjs) assets.register('js_libs', libsjs) app.config['OAUTH_CREDENTIALS'] = { 'facebook': {
from gitlaber.views import view from gitlaber import config application = Flask(__name__,\ static_folder="gitlaber/static/",\ template_folder="gitlaber/templates/", static_url_path="/static") application.secret_key = config.SECRET_KEY application.register_blueprint(view) # Scss assets = Environment(application) assets.versions = 'timestamp' assets.url_expire = True assets.manifest = 'file:c:\\manifest.to-be-deployed' # explict filename assets.cache = False assets.auto_build = True assets.url = application.static_url_path scss = Bundle('scss/00_main.scss', filters='pyscss', output='css/main.css', depends=['scss/*.scss']) assets.register('scss_all', scss) assets.debug = False application.config['ASSETS_DEBUG'] = False # Set Logger log = logging.getLogger("gitlaber") console_formatter = logging.Formatter( '%(filename)s:%(lineno)d\t\t\t%(message)s', '%m-%d %H:%M:%S') file_formatter = logging.Formatter(
import logging from flask import Flask from flask.ext.assets import Environment from flask.ext.cache import Cache from flask_frozen import Freezer from doubleoffshore import default_settings logging.basicConfig(level=logging.DEBUG) # specific loggers # logging.getLogger('requests').setLevel(logging.WARNING) # logging.getLogger('urllib3').setLevel(logging.WARNING) app = Flask(__name__) app.config.from_object(default_settings) assets = Environment(app) cache = Cache(app) freezer = Freezer(app) if not app.debug: assets.auto_build = False assets.manifest = 'file'
from os.path import dirname, join, realpath, normpath from flask.ext.assets import Environment, Bundle from app import app environment = Environment(app) environment.versions = 'hash' manifest_path = normpath(realpath(join(dirname(__file__), '.static-manifest'))) environment.manifest = 'file:%s' % manifest_path environment.cache = False environment.debug = False css_main = Bundle('css/main.css', Bundle('less/main.less', filters='less'), filters='cssmin', output='css/main.%(version)s.css') js_head = Bundle( 'https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js', output='js/head.%(version)s.js') js_foot = Bundle( 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js', Bundle('js/scripts.js', filters='jsmin'), output='js/main.%(version)s.js')
__author__ = 'hsk81' ############################################################################### ############################################################################### from flask.ext.assets import Environment from webassets.loaders import YAMLLoader from ..app import app ############################################################################### ############################################################################### loader = YAMLLoader (app.config['YML_FILE']) bundles = loader.load_bundles () assets = Environment (app) assets.manifest = 'cache' assets.register (bundles) assets.url = app.config.get ('CDN') ############################################################################### ###############################################################################
FlaskMustache.attach(app) #mustache().init_app(app) redis_store.init_app(app) app.config.update( TEMPLATES_AUTO_RELOAD = True ) assets = Environment(app) assets.url = app.static_url_path # for development # Don't cache otherwise it won't build every time assets.cache = False assets.manifest = False app.config['ASSETS_DEBUG'] = True scss = Bundle('style.scss', filters='pyscss', output='all.css') assets.register('scss_all', scss) scss.build() js_files = ['js/mustache.js', 'mustache/mustache-loader.js', 'js/mui.js', 'js/main.js'] js = Bundle(*js_files, filters='jsmin', output='packed.js') assets.register('js_all', js) js.build() assets.init_app(app) global case_bucket