from flask import Flask
from gevent import pywsgi
app = Flask(__name__)
@app.route("/")
def hello():
return "hello world"
if __name__ == '__main__':
# development
# app.run(debug=True)
# production
server = pywsgi.WSGIServer(('0.0.0.0', 9090), app)
server.serve_forever()
打包成二进制
pyinstaller -F -w app.py
require.txt
altgraph==0.17.2
click==8.1.3
Flask==2.1.2
gevent==21.12.0
greenlet==1.1.2
importlib-metadata==4.11.3
itsdangerous==2.1.2
Jinja2==3.1.2
macholib==1.16
MarkupSafe==2.1.1
pyinstaller==5.0.1
pyinstaller-hooks-contrib==2022.4
Werkzeug==2.1.2
zipp==3.8.0
zope.event==4.5.0
zope.interface==5.4.0
快速生成:
pip freeze > requirements.txt
安装所需要的包:
pip install -r requirements.txt
|