Reputation: 73
I'm trying to build an web app with python and Flask. I started working on it on Ubuntu and it works so far.
However, pulling the project into an windows environment with the same prerequisites installed does not work. More detailed, the run output looks quite alright
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
* Debugger is active!
* Debugger PIN: 239-929-141
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
But when accessing 0.0.0.0:8080 the browser is unable to reach it. And there's no more output related to what's happening.
I tested this also with the basic hello world flask app and the result is the same (on windows). Any idea if the OS is the problem here? or what else could it be?
Upvotes: 1
Views: 2949
Reputation: 1447
http://0.0.0.0 often doesn't work, you will likely need to switch to http://localhost:8080 in your browser.
Also validate you have set flask to use 0.0.0.0 and not 127.0.0.1.
I figured I should explain the second part, within a routes.py
file you want to make sure you set the host to 0.0.0.0 otherwise you won't be able to access it. So at the bottom of your routes.py
make sure you have:
from flask import Flask
app = Flask(__name__)
app.run(host="0.0.0.0")
Upvotes: 2