过程中出现的问题:
C:\Users\123\Anaconda3\envs\TF_2C\python.exe D:/python/mnist_demotest/main.py
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 151-778-155
* Running on http://0.0.0.0:8889/ (Press CTRL+C to quit)
原因:这是一个开发服务器。不要在生产部署中使用它。使用生产的WSGI服务器
WSGI(Python Web Server Gateway Interface):服务器网关接口。Web服务器和Web应用程序或框架之间的一种简单而通用的接口。
解决方法:重新定义main.py中的启动地址host:127.0.0.1,然后重新运行main.py
得到如下的结果:
C:\Users\123\Anaconda3\envs\TF_2C\python.exe D:/python/mnist_demotest/main.py
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 151-778-155
* Running on http://127.0.0.1:8889/ (Press CTRL+C to quit)
127.0.0.1 - - [02/Mar/2020 10:37:24] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [02/Mar/2020 10:37:24] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [02/Mar/2020 10:37:24] "GET /static/css/bootstrap.min.css HTTP/1.1" 200 -
127.0.0.1 - - [02/Mar/2020 10:37:24] "GET /static/js/jquery.min.js HTTP/1.1" 200 -
127.0.0.1 - - [02/Mar/2020 10:37:24] "GET /static/js/main.js HTTP/1.1" 200 -
[0.5489745140075684,
2.821251996465435e-07,
0.3152564465999603,
0.00017505102732684463,
0.00024881394347175956,
0.13371458649635315,
0.0013003373751416802,
0.00025784692843444645,
7.167013245634735e-05,
4.361908736427722e-07]
[0.15248361229896545,
0.004997850861400366,
0.35837864875793457,
0.00877372082322836,
0.17417296767234802,
0.20331420004367828,
0.05511804297566414,
0.025098957121372223,
0.017215833067893982,
0.00044615677325055003]
127.0.0.1 - - [02/Mar/2020 10:37:36] "POST /api/mnist HTTP/1.1" 200 -
[0.05925741046667099,
1.0508994563451779e-07,
0.14101934432983398,
0.046733517199754715,
0.01122485101222992,
0.07238084077835083,
0.00029219171847216785,
0.6671772599220276,
0.0015083561884239316,
0.0004060677019879222]
[0.005734917242079973,
0.004705632571130991,
0.18256424367427826,
0.04478409141302109,
0.5811722874641418,
0.01679237186908722,
0.008429295383393764,
0.14248701930046082,
0.011746295727789402,
0.0015839891275390983]
127.0.0.1 - - [02/Mar/2020 10:37:45] "POST /api/mnist HTTP/1.1" 200 -