Search code examples
pythonflaskwaitress

Not Found page when waitress start


I get this error when I access the default page after starting the flask server using the waitress.

The code is:

from app import app
from waitress import serves

if __name__ == '__main__':
     serves (app, host = "0.0.0.0", port = 8080)

I access the page http://localhost:8080 in the browser

erro: Not Found The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.


Solution

  • You need a url handler:

    @app.route('/') 
    def index():
        return "hello"