def init(db_dir, uwsgi=None): """Initialize globals and populate simulation dir""" from sirepo import uri_router uri_router.init(app, sys.modules[__name__], simulation_db) global _wsgi_app _wsgi_app = _WSGIApp(app, uwsgi) _BeakerSession().sirepo_init_app(app, py.path.local(db_dir)) simulation_db.init_by_server(app, sys.modules[__name__])
def init(uwsgi=None, use_reloader=False): """Initialize globals and populate simulation dir""" from sirepo import uri_router app.sirepo_db_dir = cfg.db_dir simulation_db.init_by_server(app) uri_router.init(app, uwsgi) for err, file in simulation_db.SCHEMA_COMMON['customErrors'].items(): app.register_error_handler(int(err), _handle_error) runner.init(app, uwsgi, use_reloader) return app
def init(db_dir=None, uwsgi=None): """Initialize globals and populate simulation dir""" from sirepo import uri_router if db_dir: cfg.db_dir = py.path.local(db_dir) else: db_dir = cfg.db_dir uri_router.init(app, sys.modules[__name__], simulation_db) global _wsgi_app _wsgi_app = _WSGIApp(app, uwsgi) _BeakerSession().sirepo_init_app(app, db_dir) simulation_db.init_by_server(app, sys.modules[__name__]) for err, file in simulation_db.SCHEMA_COMMON['customErrors'].items(): app.register_error_handler(int(err), _handle_error) runner.init(app, uwsgi) return app
def init(uwsgi=None, use_reloader=False): """Initialize globals and populate simulation dir""" global _app if _app: return #: Flask app instance, must be bound globally _app = flask.Flask( __name__, static_folder=None, template_folder=str(simulation_db.STATIC_FOLDER), ) _app.config.update(PROPAGATE_EXCEPTIONS=True, ) _app.sirepo_db_dir = sirepo.srdb.root() _app.sirepo_uwsgi = uwsgi _app.sirepo_use_reloader = use_reloader uri_router.init(_app, simulation_db) return _app
def init(uwsgi=None, use_reloader=False): """Initialize globals and populate simulation dir""" global _app if _app: return #: Flask app instance, must be bound globally _app = flask.Flask( __name__, static_folder=None, template_folder=str(simulation_db.STATIC_FOLDER), ) _app.config.update(PROPAGATE_EXCEPTIONS=True, ) _app.sirepo_db_dir = cfg.db_dir _app.sirepo_uwsgi = uwsgi http_reply.init_by_server(_app) simulation_db.init_by_server(_app) uri_router.init(_app) for e, _ in simulation_db.SCHEMA_COMMON['customErrors'].items(): _app.register_error_handler(int(e), _handle_error) runner.init(_app, use_reloader) return _app
def init(uwsgi=None, use_reloader=False): """Initialize globals and populate simulation dir""" global _app if _app: return global _google_tag_manager if cfg.google_tag_manager_id: _google_tag_manager = f'''<script> (function(w,d,s,l,i){{w[l]=w[l]||[];w[l].push({{'gtm.start':new Date().getTime(),event:'gtm.js'}});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);}})(window,document,'script','dataLayer','{cfg.google_tag_manager_id}'); </script>''' #: Flask app instance, must be bound globally _app = flask.Flask( __name__, static_folder=None, template_folder=str(simulation_db.STATIC_FOLDER), ) _app.config['PROPAGATE_EXCEPTIONS'] = True _app.sirepo_uwsgi = uwsgi _app.sirepo_use_reloader = use_reloader uri_router.init(_app, simulation_db) return _app