Configure Flask dev server to be visible across the network

前端 未结 14 2462
面向向阳花
面向向阳花 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条回答
  •  闹比i
    闹比i (楼主)
    2020-11-21 07:01

    Go to your project path on CMD(command Prompt) and execute the following command:-

    set FLASK_APP=ABC.py

    SET FLASK_ENV=development

    flask run -h [yourIP] -p 8080

    you will get following o/p on CMD:-

    • Serving Flask app "expirement.py" (lazy loading)
      • Environment: development
      • Debug mode: on
      • Restarting with stat
      • Debugger is active!
      • Debugger PIN: 199-519-700
      • Running on http://[yourIP]:8080/ (Press CTRL+C to quit)

    Now you can access your flask app on another machine using http://[yourIP]:8080/ url

提交回复
热议问题