Configure Flask dev server to be visible across the network

前端 未结 14 2662
面向向阳花
面向向阳花 2020-11-21 05:57

I\'m not sure if this is Flask specific, but when I run an app in dev mode (http://localhost:5000), I cannot access it from other machines on the network (with

14条回答
  •  耶瑟儿~
    2020-11-21 06:43

    Check whether the particular port is open on the server to serve the client or not?

    in Ubuntu or Linux distro

    sudo ufw enable
    sudo ufw allow 5000/tcp //allow the server to handle the request on port 5000
    

    Configure the application to handle remote requests

    app.run(host='0.0.0.0' , port=5000)
    
    
    python3 app.py & #run application in background
    

提交回复
热议问题