Flask server visible when hosted on macbook, but not when hosted on windows desktop? (Tried everything?) [duplicate]










1















This question already has an answer here:



  • Configure Flask dev server to be visible across the network

    7 answers



My macbook and windows desktop are on the same wifi network.



Here is the python 3 code I run on my Mac (myFlask.py):



from flask import Flask

app = Flask(__name__)
@app.route("/")
def hello():
return "Hello from Mac"

pn = 5000
ip = "192.168.1.146"

if __name__ == '__main__':
app.run(host = ip,port=pn)


When I run this on mac, and I can enter 192.168.1.146:5000 as a url on the browser on both devices and see "Hello from Mac"



Here is the python 3 code I run on my Desktop (myFlask.py):



from flask import Flask

app = Flask(__name__)
@app.route("/")
def hello():
return "Hello from Windows"

pn = 5000
ip = "192.168.1.105"

if __name__ == '__main__':
app.run(host = ip,port=pn)


The problem: When I run this on the windows desktop, and when I enter 192.168.1.105:5000 as a url on the browser on both device, I see "Hello from Windows" on the desktop, but "This site can’t be reached" on the mac.



I tried the following:



  1. I double checked the IP addresses, and 192.168.1.105 is the correct one (ipv4). I also tried all the other IP addresses from ipconfig on the windows command line, but still no luck.

  2. I took a look at externally visible server at http://flask.pocoo.org/docs/0.12/quickstart/ and tried to do $python3 myFlask.py --host=0.0.0.0 No luck here.

  3. I checked to see if DHCP is enabled in my router (Linksys) and yes it is enabled.

  4. I turned on all sharing settings on Home, Public, and Domain in the control panel at windows.

  5. I turned off the FireWall settings.

Even after all this, neither my mac nor my android phone nor my iphone nor my other mac can find the flask server hosted on the windows desktop. But all my other devices (including windows desktop) can see the flask server hosted by the mac.



What should I do?










share|improve this question













marked as duplicate by davidism flask
Users with the  flask badge can single-handedly close flask questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Nov 15 '18 at 1:09


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















    1















    This question already has an answer here:



    • Configure Flask dev server to be visible across the network

      7 answers



    My macbook and windows desktop are on the same wifi network.



    Here is the python 3 code I run on my Mac (myFlask.py):



    from flask import Flask

    app = Flask(__name__)
    @app.route("/")
    def hello():
    return "Hello from Mac"

    pn = 5000
    ip = "192.168.1.146"

    if __name__ == '__main__':
    app.run(host = ip,port=pn)


    When I run this on mac, and I can enter 192.168.1.146:5000 as a url on the browser on both devices and see "Hello from Mac"



    Here is the python 3 code I run on my Desktop (myFlask.py):



    from flask import Flask

    app = Flask(__name__)
    @app.route("/")
    def hello():
    return "Hello from Windows"

    pn = 5000
    ip = "192.168.1.105"

    if __name__ == '__main__':
    app.run(host = ip,port=pn)


    The problem: When I run this on the windows desktop, and when I enter 192.168.1.105:5000 as a url on the browser on both device, I see "Hello from Windows" on the desktop, but "This site can’t be reached" on the mac.



    I tried the following:



    1. I double checked the IP addresses, and 192.168.1.105 is the correct one (ipv4). I also tried all the other IP addresses from ipconfig on the windows command line, but still no luck.

    2. I took a look at externally visible server at http://flask.pocoo.org/docs/0.12/quickstart/ and tried to do $python3 myFlask.py --host=0.0.0.0 No luck here.

    3. I checked to see if DHCP is enabled in my router (Linksys) and yes it is enabled.

    4. I turned on all sharing settings on Home, Public, and Domain in the control panel at windows.

    5. I turned off the FireWall settings.

    Even after all this, neither my mac nor my android phone nor my iphone nor my other mac can find the flask server hosted on the windows desktop. But all my other devices (including windows desktop) can see the flask server hosted by the mac.



    What should I do?










    share|improve this question













    marked as duplicate by davidism flask
    Users with the  flask badge can single-handedly close flask questions as duplicates and reopen them as needed.

    StackExchange.ready(function()
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
    var $hover = $(this).addClass('hover-bound'),
    $msg = $hover.siblings('.dupe-hammer-message');

    $hover.hover(
    function()
    $hover.showInfoMessage('',
    messageElement: $msg.clone().show(),
    transient: false,
    position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
    dismissable: false,
    relativeToBody: true
    );
    ,
    function()
    StackExchange.helpers.removeMessages();

    );
    );
    );
    Nov 15 '18 at 1:09


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

















      1












      1








      1








      This question already has an answer here:



      • Configure Flask dev server to be visible across the network

        7 answers



      My macbook and windows desktop are on the same wifi network.



      Here is the python 3 code I run on my Mac (myFlask.py):



      from flask import Flask

      app = Flask(__name__)
      @app.route("/")
      def hello():
      return "Hello from Mac"

      pn = 5000
      ip = "192.168.1.146"

      if __name__ == '__main__':
      app.run(host = ip,port=pn)


      When I run this on mac, and I can enter 192.168.1.146:5000 as a url on the browser on both devices and see "Hello from Mac"



      Here is the python 3 code I run on my Desktop (myFlask.py):



      from flask import Flask

      app = Flask(__name__)
      @app.route("/")
      def hello():
      return "Hello from Windows"

      pn = 5000
      ip = "192.168.1.105"

      if __name__ == '__main__':
      app.run(host = ip,port=pn)


      The problem: When I run this on the windows desktop, and when I enter 192.168.1.105:5000 as a url on the browser on both device, I see "Hello from Windows" on the desktop, but "This site can’t be reached" on the mac.



      I tried the following:



      1. I double checked the IP addresses, and 192.168.1.105 is the correct one (ipv4). I also tried all the other IP addresses from ipconfig on the windows command line, but still no luck.

      2. I took a look at externally visible server at http://flask.pocoo.org/docs/0.12/quickstart/ and tried to do $python3 myFlask.py --host=0.0.0.0 No luck here.

      3. I checked to see if DHCP is enabled in my router (Linksys) and yes it is enabled.

      4. I turned on all sharing settings on Home, Public, and Domain in the control panel at windows.

      5. I turned off the FireWall settings.

      Even after all this, neither my mac nor my android phone nor my iphone nor my other mac can find the flask server hosted on the windows desktop. But all my other devices (including windows desktop) can see the flask server hosted by the mac.



      What should I do?










      share|improve this question














      This question already has an answer here:



      • Configure Flask dev server to be visible across the network

        7 answers



      My macbook and windows desktop are on the same wifi network.



      Here is the python 3 code I run on my Mac (myFlask.py):



      from flask import Flask

      app = Flask(__name__)
      @app.route("/")
      def hello():
      return "Hello from Mac"

      pn = 5000
      ip = "192.168.1.146"

      if __name__ == '__main__':
      app.run(host = ip,port=pn)


      When I run this on mac, and I can enter 192.168.1.146:5000 as a url on the browser on both devices and see "Hello from Mac"



      Here is the python 3 code I run on my Desktop (myFlask.py):



      from flask import Flask

      app = Flask(__name__)
      @app.route("/")
      def hello():
      return "Hello from Windows"

      pn = 5000
      ip = "192.168.1.105"

      if __name__ == '__main__':
      app.run(host = ip,port=pn)


      The problem: When I run this on the windows desktop, and when I enter 192.168.1.105:5000 as a url on the browser on both device, I see "Hello from Windows" on the desktop, but "This site can’t be reached" on the mac.



      I tried the following:



      1. I double checked the IP addresses, and 192.168.1.105 is the correct one (ipv4). I also tried all the other IP addresses from ipconfig on the windows command line, but still no luck.

      2. I took a look at externally visible server at http://flask.pocoo.org/docs/0.12/quickstart/ and tried to do $python3 myFlask.py --host=0.0.0.0 No luck here.

      3. I checked to see if DHCP is enabled in my router (Linksys) and yes it is enabled.

      4. I turned on all sharing settings on Home, Public, and Domain in the control panel at windows.

      5. I turned off the FireWall settings.

      Even after all this, neither my mac nor my android phone nor my iphone nor my other mac can find the flask server hosted on the windows desktop. But all my other devices (including windows desktop) can see the flask server hosted by the mac.



      What should I do?





      This question already has an answer here:



      • Configure Flask dev server to be visible across the network

        7 answers







      python windows macos flask server






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 3:26









      prince0fQueens

      103




      103




      marked as duplicate by davidism flask
      Users with the  flask badge can single-handedly close flask questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Nov 15 '18 at 1:09


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






      marked as duplicate by davidism flask
      Users with the  flask badge can single-handedly close flask questions as duplicates and reopen them as needed.

      StackExchange.ready(function()
      if (StackExchange.options.isMobile) return;

      $('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
      var $hover = $(this).addClass('hover-bound'),
      $msg = $hover.siblings('.dupe-hammer-message');

      $hover.hover(
      function()
      $hover.showInfoMessage('',
      messageElement: $msg.clone().show(),
      transient: false,
      position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
      dismissable: false,
      relativeToBody: true
      );
      ,
      function()
      StackExchange.helpers.removeMessages();

      );
      );
      );
      Nov 15 '18 at 1:09


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          This gets into the vagaries of networking. Change to



          ip = '0.0.0.0'


          and try again. When you tried to pass --port=0.0.0.0 to your app, the option was ignored, since your app isn't parsing options. The flask runner does parse them. On the Mac side, the invocation would be



          FLASK_APP=myApp.py flask run --port=0.0.0.0


          I don't know what the equivalent would be on Windows.






          share|improve this answer



























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This gets into the vagaries of networking. Change to



            ip = '0.0.0.0'


            and try again. When you tried to pass --port=0.0.0.0 to your app, the option was ignored, since your app isn't parsing options. The flask runner does parse them. On the Mac side, the invocation would be



            FLASK_APP=myApp.py flask run --port=0.0.0.0


            I don't know what the equivalent would be on Windows.






            share|improve this answer

























              0














              This gets into the vagaries of networking. Change to



              ip = '0.0.0.0'


              and try again. When you tried to pass --port=0.0.0.0 to your app, the option was ignored, since your app isn't parsing options. The flask runner does parse them. On the Mac side, the invocation would be



              FLASK_APP=myApp.py flask run --port=0.0.0.0


              I don't know what the equivalent would be on Windows.






              share|improve this answer























                0












                0








                0






                This gets into the vagaries of networking. Change to



                ip = '0.0.0.0'


                and try again. When you tried to pass --port=0.0.0.0 to your app, the option was ignored, since your app isn't parsing options. The flask runner does parse them. On the Mac side, the invocation would be



                FLASK_APP=myApp.py flask run --port=0.0.0.0


                I don't know what the equivalent would be on Windows.






                share|improve this answer












                This gets into the vagaries of networking. Change to



                ip = '0.0.0.0'


                and try again. When you tried to pass --port=0.0.0.0 to your app, the option was ignored, since your app isn't parsing options. The flask runner does parse them. On the Mac side, the invocation would be



                FLASK_APP=myApp.py flask run --port=0.0.0.0


                I don't know what the equivalent would be on Windows.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 5:35









                Dave W. Smith

                16.2k22430




                16.2k22430













                    Popular posts from this blog

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    政党

                    天津地下鉄3号線