Flask APP - ValueError: signal only works in main thread

后端 未结 2 1871
时光取名叫无心
时光取名叫无心 2020-12-08 11:13

I try to create a simple flask app:

from flask import Flask

app = Flask(__name__)

if __name__ == \'__main__\':
  app.run()

but when I add

2条回答
  •  轮回少年
    2020-12-08 11:45

    I solved the problem thanks to @AkshayKumar007 answer on github. That was the most convenient solution for me.

    Hey guys, I was also facing the same problem. So to summarize, if you're using socket-io, don't do flask run. First, add

    if __name__ == "__main__":
        socketio.run(app)
    

    At the end of your application. To run it just do

    python3 __init__.py
    

    Hope it helped.

提交回复
热议问题