Giter Club home page Giter Club logo

Comments (3)

genemiller avatar genemiller commented on August 27, 2024

The reason for 403 error can be found here https://stackoverflow.com/questions/72795799/how-to-solve-403-error-with-flask-in-python

Mac OSX Monterey (12.x) currently uses ports 5000 and 7000 for its Control centre hence the issue.
Try running your app from port other than 5000 and 7000

So I tried several unused ports like 8000:

if __name__ == "__main__":
    URL = "http://127.0.0.1:8000/"
    webbrowser.open(URL)
    print("app: socketio.run(app, port=8000, debug=True)")
    socketio.run(app, port=8000, debug=True)
    print("app: End __main__")

For each port I tried, a browser tab opened with This site can’t be reached; 127.0.0.1 refused to connect., then a few seconds later another browser tab opened with Not Found.

And the server output showed that the server started two times:

$ python app.py
app: socketio.run(app, port=8000, debug=True)
 * Restarting with stat
app: socketio.run(app, port=8000, debug=True)
 * Debugger is active!
 * Debugger PIN: 726-010-831
(57021) wsgi starting up on http://127.0.0.1:8000
(57021) accepted ('127.0.0.1', 61924)
(57021) accepted ('127.0.0.1', 61925)
127.0.0.1 - - [29/Jul/2023 20:10:05] "GET / HTTP/1.1" 404 355 0.001925

from lifefinances.

genemiller avatar genemiller commented on August 27, 2024

I will temporarily give up on MacOS, and try Windows 10 instead. Please see follow-up issue #143.

from lifefinances.

genemiller avatar genemiller commented on August 27, 2024

To free up flask's default port 5000 I disabled System Preferences > Sharing > AirPLay Receiver on MacOS 12.6.7
These 2 cases continued to fail:

  1. with __main__ section commented-out:
    -- app.py terminated with no output
  2. with comments removed from __main__, and default port 5000 specified:
    -- 1st browser tab opened with ERR 403
    -- 2nd browser tab opened with ERR 404

from lifefinances.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.