简体   繁体   中英

Access localhost from another computer on the same network (flask python server)?

my code:

from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

@app.route("/")
def helloWorld():
    print('ok')
    return "Hello, cross-origin-world!"


if __name__ == '__main__':
    app.run(host = '0.0.0.0', port = 5000)

Firewall settings
Created 2 inbound rules for TCP and UDP on PORT 5000

> ipconfig /all

IPv4 Address. . . . . . . . . . . : 192.168.1.2(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : fe80::1%6
                                    192.168.1.1

Still I can't access 192.168.1.2:5000 from another computer on the same network. (ERR_CONNECTION_TIMED_OUT)

Is there something else I can try ? (or somehow debug to check what is blocking the connection ?)

尝试停止防火墙,我只有在它停止时才对我起作用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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