D
D
Danil Samodurov2021-04-10 14:20:42
Flask
Danil Samodurov, 2021-04-10 14:20:42

How to fix WinError 10049 when changing host on Flask server?

Hello. I wanted to check if the page will be opened from another computer on the Internet if I pass it as an argument when starting the server in flask: app.run(debug=True, host='ip'), where ip is my ip on the Internet (looked at https:// myip.ru/ , I'm sitting at the router). When running the script, it gives an error: OSError: [WinError 10049] The required address for its context is incorrect. Why? Miguel Greenberg's Flask book doesn't mention this. It only says: "... the web server will be accessible from any computer on the network at: ' abcd:5000 ', where "abcd" is the external IP address of the computer where the web server is running."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2021-04-10
@pcdesign

I'm sitting at the router

It is necessary to open a port on the router and forward it to the local machine with a flask.
app.run(debug=True, host='your local ip address behind the router, like 192.168...')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question