def initialize_app(flask_app): configure_app(flask_app) blueprint = Blueprint('api', __name__, url_prefix='/api') api.init_app(blueprint) api.add_namespace(user_posts_namespace) flask_app.register_blueprint(blueprint) db.init_app(flask_app)
def init_app(app, config_type): configure_app(app, config_type) app.url_map.strict_slashes = False db.init_app(app) api.init_app(app) api.add_namespace(ns) if config_type == "testing": with app.app_context(): db.drop_all() db.create_all()
def initialize_app(app): app.config["RESTPLUS_VALIDATE"] = True app.config['ERROR_404_HELP'] = False config_db(app) blueprint = Blueprint('api', __name__) api.init_app(blueprint) app.register_blueprint(blueprint) api.add_namespace(ns_default) api.add_namespace(ns_category)
def create_app(): app = Flask(__name__) app.config.from_object(Config) blueprint = Blueprint('api', __name__, url_prefix='/api') api.init_app(blueprint) # Iterates over the namespaces list and adds them to the API for namespace in namespaces: api.add_namespace(namespace) app.register_blueprint(blueprint) db.init_app(app) return app
def create_app(app=app, db_url=os.environ.get('DATABASE_DEFAULT_URL')): app.config['RESTPLUS_VALIDATE'] = True app.config['ERROR_404_HELP'] = False app.url_map.strict_slashes = False config_db(app, db_url) blueprint = Blueprint('api', __name__) api.init_app(blueprint) api.security = 'oauth2' api.authorizations = authorizations api.add_namespace(ns_book) api.add_namespace(ns_client) app.register_blueprint(blueprint) return app
def initialize_app(flask_app): blueprint = Blueprint('api', __name__, url_prefix='/api') api.init_app(blueprint) flask_app.register_blueprint(blueprint) api.add_namespace(user_namespace) api.add_namespace(movies_namespace) api.add_namespace(bookings_namespace)
# @api_v1.route('/search/') # def api_search(): # """API - Search.""" # q = request.args.get('q', None) # page = get_page() # return jsonify({'result': list(Volume.query_as_pagination( # q, page, PAGE_SIZE).items())}) ns = api.namespace('book', description='Operations related to books') @ns.route('/search/') class HaodooScraperAPI(Resource): """API for HaodooScraper books.""" @api.expect(query_arguments, validate=True) def get(self): args = query_arguments.parse_args(request) page = args.get('page', 1) per_page = args.get('per_page', 10) q = args.get('q', '') return {'result': list(Volume.query_as_pagination( q, page, PAGE_SIZE).items())} api.add_namespace(ns) app.register_blueprint(blueprint)
# @api_v1.route('/search/') # def api_search(): # """API - Search.""" # q = request.args.get('q', None) # page = get_page() # return jsonify({'result': list(Volume.query_as_pagination( # q, page, PAGE_SIZE).items())}) ns = api.namespace('book', description='Operations related to books') @ns.route('/search/') class HaodooScraperAPI(Resource): """API for HaodooScraper books.""" @api.expect(query_arguments, validate=True) def get(self): args = query_arguments.parse_args(request) page = args.get('page', 1) per_page = args.get('per_page', 10) q = args.get('q', '') return { 'result': list(Volume.query_as_pagination(q, page, PAGE_SIZE).items()) } api.add_namespace(ns) app.register_blueprint(blueprint)
def init_app(flask_app): blueprint = Blueprint('api', __name__, url_prefix='/api') api.init_app(blueprint) api.add_namespace(test_namespace) api.add_namespace(document_namespace) flask_app.register_blueprint(blueprint)
flask_app.config[ 'SQLALCHEMY_DATABASE_URI'] = settings.SQLALCHEMY_DATABASE_URI flask_app.config[ 'SQLALCHEMY_TRACK_MODIFICATIONS'] = settings.SQLALCHEMY_TRACK_MODIFICATIONS flask_app.config[ 'SWAGGER_UI_DOC_EXPANSION'] = settings.RESTPLUS_SWAGGER_UI_DOC_EXPANSION flask_app.config['RESTPLUS_VALIDATE'] = settings.RESTPLUS_VALIDATE flask_app.config['RESTPLUS_MASK_SWAGGER'] = settings.RESTPLUS_MASK_SWAGGER flask_app.config['ERROR_404_HELP'] = settings.RESTPLUS_ERROR_404_HELP CORS(flask_app) blueprint = Blueprint('api', __name__, url_prefix='/api/v01') api.init_app(blueprint) api.add_namespace(unidade_namespace) api.add_namespace(subunidade_namespace) api.add_namespace(docente_namespace) api.add_namespace(curso_namespace) api.add_namespace(biblioteca_namespace) app = Flask(__name__) configure_app(app) app.register_blueprint(blueprint) @app.route('/') def index(): return render_template('index.html')
def configure_app(flask_app): flask_app.config['SQLALCHEMY_DATABASE_URI'] = settings.SQLALCHEMY_DATABASE_URI flask_app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = settings.SQLALCHEMY_TRACK_MODIFICATIONS flask_app.config['SWAGGER_UI_DOC_EXPANSION'] = settings.RESTPLUS_SWAGGER_UI_DOC_EXPANSION flask_app.config['RESTPLUS_VALIDATE'] = settings.RESTPLUS_VALIDATE flask_app.config['RESTPLUS_MASK_SWAGGER'] = settings.RESTPLUS_MASK_SWAGGER flask_app.config['ERROR_404_HELP'] = settings.RESTPLUS_ERROR_404_HELP CORS(flask_app) blueprint = Blueprint('api', __name__, url_prefix='/api/v01') api.init_app(blueprint) api.add_namespace(docente_namespace) api.add_namespace(subunidade_namespace) api.add_namespace(curso_namespace) api.add_namespace(discente_namespace) api.add_namespace(monografia_namespace) app = Flask(__name__) configure_app(app) app.register_blueprint(blueprint) jwt = JWT(app, authenticate, identity) @app.route('/') def index(): return render_template('index.html')