简体   繁体   English

在没有前端的情况下在Heroku上使用Flask部署Python socket.io应用

[英]Deploying Python socket.io app using Flask on Heroku without Frontend

I have a Python socket app build in Flask which is to be hosted on Heroku. 我在Flask中构建了一个Python套接字应用,该应用将托管在Heroku上。 Now, I know that I can connect the Flask app through the client end socket which I have built in Javascript. 现在,我知道可以通过使用Java内置的客户端套接字连接Flask应用了。 The UI is also embedded with the client end. UI也嵌入在客户端中。 I wish to deploy the Flask app without any frontend/UI HTML file but it outputs the following error: 我希望在没有任何前端/ UI HTML文件的情况下部署Flask应用程序,但是会输出以下错误:

00:19:45 web.1 | 00:19:45 web.1 | 2018-06-27 00:19:45 [12308] [ERROR] Connection in use: ('0.0.0.0', 5000) 2018-06-27 00:19:45 [12308] [错误]使用中的连接:('0.0.0.0',5000)

00:19:45 web.1 | 00:19:45 web.1 | 2018-06-27 00:19:45 [12308] [ERROR] Retrying in 1 second. 2018-06-27 00:19:45 [12308] [错误] 1秒后重试。

00:19:46 web.1 | 00:19:46 web.1 | 2018-06-27 00:19:46 [12308] [ERROR] Connection in use: ('0.0.0.0', 5000) 2018-06-27 00:19:46 [12308] [错误]使用中的连接:('0.0.0.0',5000)

00:19:46 web.1 | 00:19:46 web.1 | 2018-06-27 00:19:46 [12308] [ERROR] Retrying in 1 second. 2018-06-27 00:19:46 [12308] [错误] 1秒后重试。

You need to use the bellow line in your Procfile: 您需要在Procfile中使用以下行:

web: gunicorn --worker-class eventlet -w 1 module:app

More informations about Gunicorn Web Server on: https://flask-socketio.readthedocs.io/en/latest/#gunicorn-web-server 有关Gunicorn Web服务器的更多信息,请访问: https ://flask-socketio.readthedocs.io/en/latest/#gunicorn-web-server

Obs.: You need to install eventlet. 观察:您需要安装eventlet。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM