Flask app running on 0.0.0.0:80 is not accessible from external browser or restapi clients

Question:
I have created sample flask app from Flask template available and executed Run, it’s started and accessible locally but not from external browser or rest api clients.
on webview, it’s displayed below message and then able to access it with ‘/’ locally on webview, but not with https://..repl.co/

# Hmm... We couldn't reach this Repl
## Make sure this Repl has a port open and is ready to receive HTTP traffic.
Log on terminal:
[2024-02-11 04:12:45 +0000] [178] [INFO] Starting gunicorn 21.2.0
[2024-02-11 04:12:45 +0000] [178] [INFO] Listening at: http://0.0.0.0:80 (178)
[2024-02-11 04:12:45 +0000] [178] [INFO] Using worker: sync
[2024-02-11 04:12:45 +0000] [182] [INFO] Booting worker with pid: 182
[2024-02-11 04:12:45 +0000] [178] [INFO] Handling signal: winch

Repl link:

https://replit.com/@diwyankb/FlaskSample#main.py

from flask import Flask

app = Flask(__name__)


@app.route('/')
def index():
  return 'Hello from Flask!'

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

In the future, please format your code like so:

from flask import Flask

app = Flask(__name__)


@app.route('/')
def index():
    return 'Hello from Flask!'

if __name__ == '__main__':
  app.run(host='0.0.0.0', port=80)
```python
from flask import Flask

app = Flask(__name__)


@app.route('/')
def index():
    return 'Hello from Flask!'

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

Hi @diwyankb , welcome to the forums!

repl.co domains have been removed, and are replaced with replit.dev domains. Hence, this url will not work. Opening the website in a New Tab should show the website. In any case that it doesn’t, could you send a screenshot of the bug then?
Hope this helps!

4 Likes

The issue could be related to this topic: Replit Webview is doing repl.co instead of replit.dev.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.