The flask host adress in docker run The flask host adress in docker run python-3.x python-3.x

The flask host adress in docker run


In the first solution, when you run the code with the python3 app.py command, it runs on 0.0.0.0 on the host.But the flask run command executes the flask app directly from the code and does not include the condition if name == 'main':.On the other hand, when you run the code with python3 app.py, name equals 'main'. But when you run the code with flask run, name is equal to the FLASK_APP variable that becomes an app in your code, and the FLASK_APP variable must be the same as the file name that flask app contains.

app.py

print("__name__ is :", __name__)

python3 app.py

__name__ is : __main__

app.py

$> export FLASK_APP=app.py$> flask run...__name__ is : app...