def create_app(): # Create application app = Flask(__name__) app.json_encoder = MongoJSONEncoder app.url_map.converters['objectid'] = ObjectIdConverter app.config['custom'] = Config().config SECRET_KEY = os.urandom(32) app.config['SECRET_KEY'] = SECRET_KEY # csrf = CSRFProtect() # csrf.init_app(app) login_manager = LoginManager(app) login_manager.login_view = 'login' app.config['login_manager'] = login_manager @login_manager.user_loader def load_user(user): return User.find_one(user) Database.initialize() register_blueprints(app) return app
def run_agent(args=None): """Creates and runs the agent.""" setup_logging(args.debug) app_conf = Config() Database.initialize() jenkins_agent = JenkinsAgent(app_conf.config['jenkins']['user'], app_conf.config['jenkins']['password'], app_conf.config['jenkins']['url']) DFG_db_lib.insert_DFG_data_to_db(DFGs) jenkins_agent.run()