def initialize_app():
app.logger.setLevel(logging.DEBUG)
file_handler = RotatingFileHandler(
'flask.log', maxBytes=1024 * 1024 * 100, backupCount=3)
file_handler.setLevel(logging.DEBUG)
app.logger.addHandler(file_handler)
initialize_db()
# Set up the flast_restplus API
# See
# http://michal.karzynski.pl/blog/2016/06/19/building-beautiful-restful-apis-using-flask-swagger-ui-flask-restplus/
blueprint = Blueprint('api', __name__, url_prefix='/api')
api.init_app(blueprint)
# api.add_namespace(sgs_namespace)
# api.add_namespace(cidrs_namespace)
app.register_blueprint(blueprint)
# Set up Swagger Docs
# See http://github.com/rantav/flask-restful-swagger
# NOTE: this may not be needed. See if flask_restplus already provides this
# api = swagger.docs(Api(app), apiVersion='0.1')
评论列表
文章目录