-1

I am noticing that the Flask default server should not be used for the production server.
However, in my case, I just want to share a prototype web application created by Flask in the company's intranet using port80.
I tried to specify port referring to stackoverflow page by the following code.

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

But they still run on 127.0.0.1:5000. (refer to screen capture of command prompt)
enter image description here Does anyone know what I should revise in order to run the flask application using port 80?

Benyamin Karimi
  • 133
  • 1
  • 1
  • 9
Katsuya Obara
  • 903
  • 3
  • 14
  • 30

3 Answers3

1

Please try to run it with

python <yourfile>.py

flask run might be a cause of your problem

N. Arunoprayoch
  • 922
  • 12
  • 20
1

As mentioned in the Documentation, flask run will run the development server on 127.0.0.1:5000 and ignore your app.run:

The run command will start the development server. It replaces the Flask.run() method in most cases.

https://flask.palletsprojects.com/en/1.0.x/cli/#run-the-development-server

So instead of using flask run just execute your script directly with Python.

SitiSchu
  • 1,361
  • 11
  • 20
1

The correct way to launch this using flask run is by specifying the -h flag:

flask run -h 0.0.0.0
v25
  • 7,096
  • 2
  • 20
  • 36