#!/usr/bin/python3 # -*- coding: utf-8 -*- import argparse import logging import os import sys pwd = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(pwd, "../../")) from flask import Flask from gevent import pywsgi import log from server.asr_server import settings log.setup(log_directory=settings.log_directory) from server.flask_server.view_func.heart_beat import heart_beat logger = logging.getLogger("server") # 初始化服务 flask_app = Flask(__name__) flask_app.add_url_rule(rule="/HeartBeat", view_func=heart_beat, methods=["GET", "POST"], endpoint="HeartBeat") if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "--port", default=settings.port, type=int, ) args = parser.parse_args() logger.info("model server is already, port: {}".format(args.port)) # flask_app.run( # host="0.0.0.0", # port=args.port, # ) server = pywsgi.WSGIServer( listener=("0.0.0.0", args.port), application=flask_app ) server.serve_forever()