Just starting to play around with Flask on a local server and I’m noticing the request/response times are way slower than I feel they should be.
Just a simple server like the following takes close to 5 seconds to respond.
from flask import Flask
app = Flask(__name__)
@app.route("/")
def index():
return "index"
if __name__ == "__main__":
app.run()
Any ideas? Or is this just how the local server is?
Ok I figured it out. It appears to be an issue with Werkzeug and os’s that support ipv6.
From the Werkzeug site http://werkzeug.pocoo.org/docs/serving/:
So the fix is to disable ipv6 from the localhost by commenting out the following line from my hosts file:
Once I do this the latency problems go away.
I’m really digging Flask and I’m glad that it’s not a problem with the framework. I knew it couldn’t be.