def app(): app = Flask(__name__, template_folder='../templates') app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL_TEST') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['SECRET_KEY'] = '@##&6cweafhv3426445' app.config['REMEMBER_COOKIE_HTTPONLY'] = False app.config['SESSION_COOKIE_HTTPONLY'] = False app.config['TESTING'] = True app.url_map.strict_slashes = False app.json_encoder = EnumJSONEncoder login_manager = LoginManager() login_manager.init_app(app) db.init_app(app) app.app_context().push() install_database_extensions() install_models() install_routes() install_local_providers() app.mailjet_client = Mock() @app.route('/test/signin', methods=['POST']) def test_signin(): from flask import request identifier = request.get_json().get("identifier") user = find_user_by_email(identifier) login_user(user, remember=True) return jsonify({}), 204 return app
def app(): app = Flask(__name__, template_folder='../templates') app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db.init_app(app) with app.app_context(): install_models() return app
# mail = Mail() app = Flask(__name__) # ------------------------- # --- DB configuration ---- # ------------------------- app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') #pp.config['SQLALCHEMY_DATABASE_URI'] = config.get('Database Parameters','database_url') db.init_app(app) CORS(app) with app.app_context(): install_models() import routes # --- TESTING THE SERVER IS WORKING ----------- @app.route('/testmethod', methods=['GET', 'POST']) def mytest(): result = dict() result['test'] = 'ok' return jsonify(result), 200 ########################################################### # let's start ###########################################################
def install_data(): with app.app_context(): install_models() upsert_tuto_mediations() install_local_providers() logger.info("Models and LocalProviders installed")