def init_app(app, db, extra_config_settings={}): # Initialize app config settings app.config.from_object('webrob.config.settings') # Read config from 'app/settings.py' file app.config.update(extra_config_settings) # Overwrite with 'extra_config_settings' parameter if app.testing: app.config['WTF_CSRF_ENABLED'] = False # Disable CSRF checks while testing # Setup Flask-Mail mail = Mail(app) babel = Babel(app) # Setup Flask-User to handle user account related forms from webrob.models.users import User db_adapter = SQLAlchemyAdapter(db, User) user_manager = UserManager(db_adapter, app) # Init Flask-User and bind to app # Load all models.py files to register db.Models with SQLAlchemy from webrob.models import users from webrob.models import tutorials # Load all views.py files to register @app.routes() with Flask from webrob.pages import views from webrob.pages import editor from webrob.pages import log from webrob.pages import login init_db(app, db) return app
def init_app(app, db, extra_config_settings={}): # Initialize app config settings app.config.from_object( 'webrob.config.settings') # Read config from 'app/settings.py' file app.config.update(extra_config_settings ) # Overwrite with 'extra_config_settings' parameter if app.testing: app.config[ 'WTF_CSRF_ENABLED'] = False # Disable CSRF checks while testing # Setup Flask-Mail mail = Mail(app) babel = Babel(app) # Setup Flask-User to handle user account related forms from webrob.models.users import User db_adapter = SQLAlchemyAdapter(db, User) user_manager = UserManager(db_adapter, app) # Init Flask-User and bind to app # Load all models.py files to register db.Models with SQLAlchemy from webrob.models import users from webrob.models import tutorials # Load all views.py files to register @app.routes() with Flask from webrob.pages import views from webrob.pages import editor from webrob.pages import log from webrob.pages import login init_db(app, db) return app
def init_app(app, db_instance, extra_config_settings={}): # Initialize app config settings app.config.from_object("webrob.config.settings") # Read config from 'app/settings.py' file app.config.update(extra_config_settings) # Overwrite with 'extra_config_settings' parameter if app.testing: app.config["WTF_CSRF_ENABLED"] = False # Disable CSRF checks while testing if os.environ["EASE_DEBUG"] == "true": app.config["DEBUG"] = True app.config["SECRET_KEY"] = app.config["DEV_SECRET_KEY"] else: try: app.config["SECRET_KEY"] = open("/etc/ease_secret/secret", "rb").read() except IOError: app.config["SECRET_KEY"] = random_string(64) # Setup Flask-Mail mail = Mail(app) babel = Babel(app) # Setup Flask-User to handle user account related forms from webrob.models.users import User db_adapter = SQLAlchemyAdapter(db_instance, User) app.user_manager = UserManager(db_adapter, app) # Init Flask-User and bind to app # Load all models.py files to register db.Models with SQLAlchemy from webrob.models import users from webrob.models import tutorials from webrob.models import teaching from webrob.models import experiments # Load all views.py files to register @app.routes() with Flask from webrob.pages import api from webrob.pages import db from webrob.pages import editor from webrob.pages import experiments from webrob.pages import knowrob from webrob.pages import login from webrob.pages import meshes from webrob.pages import mongo from webrob.pages import tutorials from webrob.pages import oauth init_db(app, db_instance) init_webapp(app, db_instance) add_user( app=app, db=db_instance, user_manager=app.user_manager, name="admin", mail=os.environ.get("OPENEASE_MAIL_USERNAME", "*****@*****.**"), pw=os.environ.get("OPENEASE_ADMIN_PASSWORD"), roles=["admin"], ) app.logger.info("Webapp started.") return app
def init_app(app, db_instance, extra_config_settings={}): # Initialize app config settings app.config.from_object('webrob.config.settings') # Read config from 'app/settings.py' file app.config.update(extra_config_settings) # Overwrite with 'extra_config_settings' parameter if app.testing: app.config['WTF_CSRF_ENABLED'] = False # Disable CSRF checks while testing if os.environ['EASE_DEBUG'] == 'true': app.config['DEBUG'] = True app.config['SECRET_KEY'] = app.config['DEV_SECRET_KEY'] else: try: app.config['SECRET_KEY'] = open('/etc/ease_secret/secret', 'rb').read() except IOError: app.config['SECRET_KEY'] = random_string(64) # Setup Flask-Mail mail = Mail(app) babel = Babel(app) # Setup Flask-User to handle user account related forms from webrob.models.users import User db_adapter = SQLAlchemyAdapter(db_instance, User) user_manager = UserManager(db_adapter, app) # Init Flask-User and bind to app # Load all models.py files to register db.Models with SQLAlchemy from webrob.models import users from webrob.models import tutorials from webrob.models import experiments # Load all views.py files to register @app.routes() with Flask from webrob.pages import api from webrob.pages import db from webrob.pages import editor from webrob.pages import experiments from webrob.pages import knowrob from webrob.pages import login from webrob.pages import meshes from webrob.pages import mongo from webrob.pages import tutorials init_db(app, db_instance) init_webapp(app, db_instance) add_user(app,db_instance,user_manager,'admin', os.environ.get('OPENEASE_MAIL_USERNAME', '*****@*****.**'), os.environ.get('OPENEASE_ADMIN_PASSWORD'), ['admin']) app.logger.info("Webapp started.") return app
def init_app(app, db_instance, extra_config_settings={}): _init_app_config_settings(app, extra_config_settings) # Setup Flask-Mail mail = Mail(app) babel = Babel(app) # Setup Flask-User to handle user account related forms from webrob.models.users import User db_adapter = SQLAlchemyAdapter(db_instance, User) app.user_manager = UserManager(db_adapter, app) # Init Flask-User and bind to app # Load all models.py files to register db.Models with SQLAlchemy # Needs to remain in code, even if IDEs might show it's unused, Flask will use them during runtime from webrob.models import users from webrob.models import tutorials from webrob.models import teaching from webrob.models import experiments # Load all views.py files to register @app.routes() with Flask # Needs to remain in code, even if IDEs might show it's unused, Flask will use them during runtime from webrob.pages import api from webrob.pages import db from webrob.pages import editor from webrob.pages import experiments from webrob.pages import knowrob from webrob.pages import login from webrob.pages import meshes from webrob.pages import mongo from webrob.pages import tutorials from webrob.pages import oauth init_db(app, db_instance) init_webapp(app, db_instance) add_user(app=app, db=db_instance, user_manager=app.user_manager, name='admin', mail=evg.get_variable_with_default('OPENEASE_MAIL_USERNAME', '*****@*****.**'), pw=evg.get_required_variable('OPENEASE_ADMIN_PASSWORD'), roles=['admin']) _log_webapp_started(app) return app
def init_app(app, db, extra_config_settings={}): # Initialize app config settings app.config.from_object('webrob.config.settings') # Read config from 'app/settings.py' file app.config.update(extra_config_settings) # Overwrite with 'extra_config_settings' parameter if app.testing: app.config['WTF_CSRF_ENABLED'] = False # Disable CSRF checks while testing if os.environ['EASE_DEBUG'] == 'true': app.config['DEBUG'] = True app.config['SECRET_KEY'] = app.config['DEV_SECRET_KEY'] else: try: app.config['SECRET_KEY'] = open('/etc/ease_secret/secret', 'rb').read() except IOError: app.config['SECRET_KEY'] = random_string(64) # Setup Flask-Mail mail = Mail(app) babel = Babel(app) # Setup Flask-User to handle user account related forms from webrob.models.users import User db_adapter = SQLAlchemyAdapter(db, User) user_manager = UserManager(db_adapter, app) # Init Flask-User and bind to app # Load all models.py files to register db.Models with SQLAlchemy from webrob.models import users from webrob.models import tutorials # Load all views.py files to register @app.routes() with Flask register_routes() init_db(app, db) if str(app.name) == 'login': # Initialize DB content init_user_roles(user_manager) init_admin_user(app, user_manager) db_adapter.commit() app.logger.info("Webapp started.") return app