Flask实现api接口
from flask import Flask
from flask import Blueprint
from flask_restful import Resource,Api
app = Flask(__name__)
main_blueprint = Blueprint('main', __name__)
api = Api(main_blueprint, *args, errors=errors, **kwargs)
api.add_resource(IndexApi, '/')
class IndexApi(Resource):
"""ci 安全检查"""
def get(self):
return {'msg': 'ok'}
app.register_blueprint(main_blueprint)
使用gunicorn启动flask,worker_class 选择 gevent.