python web服务 flask服务

前言全局说明

python 提供的web服务


方式一、运行 Flask 服务

使用python 自带的web服务器

python3 index.py runserver 0.0.0.0:5000
或
python3 index.py runserver

index.py 是你写好,要运行的 flask 代码文件名
代码里app.run(host='0.0.0.0',port = 5000) 指定 IP和端口,启动时就不用再指定了

效果:
image
image


方式二、运行一个HTTP服务器

python3 -m http.server 8000
python2 -m SimpleHTTPServer

网页启动路径,就是当前执行命令路径




免责声明:本号所涉及内容仅供安全研究与教学使用,如出现其他风险,后果自负。




参考、来源:
https://www.cnblogs.com/wutou/p/15857551.html



posted @ 2024-01-06 17:19  悟透  阅读(40)  评论(0编辑  收藏  举报