Jelajahi Sumber

gunicorn-gevent start

liqian 2 tahun lalu
induk
melakukan
19f6e63bc8
2 mengubah file dengan 16 tambahan dan 2 penghapusan
  1. 2 2
      app.py
  2. 14 0
      gunicorn.config.py

+ 2 - 2
app.py

@@ -299,7 +299,7 @@ def apprun(MULTI_PROCESS=True, ip='0.0.0.0', port=5001):
 
 if __name__ == '__main__':
     
-    # app.run(debug=True)
+    app.run()
     #server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
     #server.serve_forever()
-    apprun()
+    # apprun()

+ 14 - 0
gunicorn.config.py

@@ -0,0 +1,14 @@
+import os
+# 日志配置
+# 本地日志存储路径
+log_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "logs")
+if not os.path.exists(log_path):
+    os.makedirs(log_path)
+loglevel = "debug"
+accesslog = os.path.join(log_path, 'access.log')
+errorlog = os.path.join(log_path, 'error.log')
+
+workers = 5
+# 设置工作模式为协程
+worker_class = "gevent"
+bind = "0.0.0.0:5001"