add listenport config

This commit is contained in:
lipku 2024-05-05 13:18:18 +08:00
parent 6a1f2e4f48
commit 8c012c5ab8
1 changed files with 3 additions and 1 deletions

4
app.py
View File

@ -400,6 +400,8 @@ if __name__ == '__main__':
parser.add_argument('--CHARACTER', type=str, default='test')
parser.add_argument('--EMOTION', type=str, default='default')
parser.add_argument('--listenport', type=int, default=8000)
opt = parser.parse_args()
app.config.from_object(opt)
print(app.config)
@ -477,7 +479,7 @@ if __name__ == '__main__':
print('start websocket server')
#app.on_shutdown.append(on_shutdown)
#app.router.add_post("/offer", offer)
server = pywsgi.WSGIServer(('0.0.0.0', 8000), app, handler_class=WebSocketHandler)
server = pywsgi.WSGIServer(('0.0.0.0', opt.listenport), app, handler_class=WebSocketHandler)
server.serve_forever()