Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何将flask socketio应用程序部署到Google云平台应用程序引擎_Python_Google App Engine_Flask_Google Cloud Platform_Flask Socketio - Fatal编程技术网

Python 如何将flask socketio应用程序部署到Google云平台应用程序引擎

Python 如何将flask socketio应用程序部署到Google云平台应用程序引擎,python,google-app-engine,flask,google-cloud-platform,flask-socketio,Python,Google App Engine,Flask,Google Cloud Platform,Flask Socketio,我编写了一个flask socketio应用程序,通过websockets向网站提供数据 我的目录结构如下: runtime: python38 handlers: - url: / static_files: website/index.html upload: website/index.html - url: / static_dir: website entrypoint: python main.py app = Flask(__name__)

我编写了一个flask socketio应用程序,通过websockets向网站提供数据

我的目录结构如下:

runtime: python38

handlers:
  - url: /
    static_files: website/index.html
    upload: website/index.html

  - url: /
    static_dir: website

entrypoint: python main.py
app = Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins="*")

[...]

def run_app():
    socketio.run(app, debug=True)


if __name__ == "__main__":
    run_app()
var socket = io.connect("https://codevis.ew.r.appspot.com:5000");
  • main.py
  • 网站
    • index.html
    • main.js
    • style.css
我的app.yaml是这样的:

runtime: python38

handlers:
  - url: /
    static_files: website/index.html
    upload: website/index.html

  - url: /
    static_dir: website

entrypoint: python main.py
app = Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins="*")

[...]

def run_app():
    socketio.run(app, debug=True)


if __name__ == "__main__":
    run_app()
var socket = io.connect("https://codevis.ew.r.appspot.com:5000");
我在目录中运行了gcloud app deploy,并设法将网站部署到GCP。现可于

但是,flask socketio应用程序没有运行,我无法通过网站连接到它

My main.py部署flask socketio应用程序如下:

runtime: python38

handlers:
  - url: /
    static_files: website/index.html
    upload: website/index.html

  - url: /
    static_dir: website

entrypoint: python main.py
app = Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins="*")

[...]

def run_app():
    socketio.run(app, debug=True)


if __name__ == "__main__":
    run_app()
var socket = io.connect("https://codevis.ew.r.appspot.com:5000");
在我的main.js中,我试图连接到flask socketio,如下所示:

runtime: python38

handlers:
  - url: /
    static_files: website/index.html
    upload: website/index.html

  - url: /
    static_dir: website

entrypoint: python main.py
app = Flask(__name__)
socketio = SocketIO(app, cors_allowed_origins="*")

[...]

def run_app():
    socketio.run(app, debug=True)


if __name__ == "__main__":
    run_app()
var socket = io.connect("https://codevis.ew.r.appspot.com:5000");

本地测试烧瓶插座时(使用var socket=io.connect(“http://127.0.0.1:5000)一切都很完美。我只是无法让GCP应用程序引擎实际运行flask socketio应用程序。我做错了什么?

应用程序引擎标准不支持WebSocket。您可以在上完成,但不能扩展到0(这意味着额外的成本)


对于0级平台,可以考虑云运行,它可以很快接受定向WebSooC.

< P> App Engine标准不支持WebSoCukes。您可以在上完成,但不能扩展到0(这意味着额外的成本)

对于一个0级平台,可以考虑云运行,它可以很快接受定向WebSoCuff.< /P> < P>我遇到了一个存在这个特性的实现。

您可以将其作为明星,以使其获得可见性,并将您的电子邮件包含在CC部分,以便接收有关此内容的进一步更新。但是,请记住,由于这是一个功能请求,目前还没有可用于实现的ETA。

我遇到了一个用于实现此功能的现有ETA

您可以将其作为明星,以使其获得可见性,并将您的电子邮件包含在CC部分,以便接收有关此内容的进一步更新。但是,请记住,由于这是一个功能请求,因此目前没有可用于实现的ETA