Waitress is working fine with localhost but not on 0.0.0.0

255 Views Asked by At

When I run my app.py with 127.0.0.1 or my IP, it works fine. But I need that running on 0.0.0.0, and I receive an error: Cannot access this site. The http://0.0.0.0:8000/ page may be temporarily unavailable or may have been permanently moved to a new web address. ERR_ADDRESS_INVALID I have already done the deploy on Railway, and it was fine also, however I received another error: Application failed to respond. My code:

import os
from flask import Flask, jsonify, request, render_template
import openai
from waitress import serve


app = Flask(__name__)


PORT = 8000

if __name__ == '__main__':
    serve(app, host='0.0.0.0', port=PORT)

The PORT is working fine also, when I "run netstat -an | find /i "listening", everything is ok, I think. What I have to do is to make my app run, I am using python version 3.12.0, I think that could be the problem.

I'd appreciate a little help, thank you!

In all the PORTS the localhost and 127.0.0.1 works fine, but the 0.0.0.0 doesn't.

0

There are 0 best solutions below