Skip to content

Commit

Permalink
优化异常处理
Browse files Browse the repository at this point in the history
电脑名中包含中文名时不能正常启动flask后台
  • Loading branch information
laorange committed May 20, 2022
1 parent a170494 commit 1e8e716
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,11 @@ def hello_world():


if __name__ == '__main__':
app.run(port=8000)
# app.run(host="0.0.0.0", port=80)
try:
app.run(port=8000)
# app.run(host="0.0.0.0", port=80)
except UnicodeDecodeError:
print("非常抱歉,您的电脑名中包含ASCII码不能解析的字符(例如中文字符),请在“控制面板-系统-关于”中修改电脑名为纯英文后重试。因为需要在本机开启后台,为您带来的不便,还请谅解!")
except:
import traceback
print(traceback.format_exc())

0 comments on commit 1e8e716

Please sign in to comment.