# python3 --version ---> Python 3.7.0
pip3 install pipenv
mkdir myproject && cd myproject
pipenv --python 3.7
pipenv shell
(myproject) [root@localhost myproject]# pipenv install flask
(myproject) [root@localhost myproject]# cat app.py
from flask import Flask
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return '<h1>Hello World!</h1>'
if __name__ == '__main__':
app.run()
# 默认端口5000, 指定地址,端口: app.run(host='0.0.0.0',port=8080)
(myproject) [root@localhost myproject]# python app.py
[root@localhost ~]# curl 127.0.0.1:5000
<h1>Hello World!</h1>