Okay so I've realized that something weird is happening when I try to upload more than I specified in my config.py
which is:
class Config:
#other configurations
MAX_CONTENT_LENGTH = 10 * 1024 * 1024
When I try to upload more than 10 MB, instead of giving me a 413 Error, application just refuses to connect. My error handler:
@errors.app_errorhandler(413)
def error_413(error):
return render_template('errors/413.html'), 413
My run.py
:
from flaskblog import create_app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
I can see on terminal that I've gotten this error:
"POST /foo/bar HTTP/1.1" 413 -
Although my app seems to be running on the terminal, I can't access it whatsoever. It's just dead on the browser:
ERR_CONNECTION_REFUSED
I tried running it on uWSGI, Werkzeug, other browsers, no luck.
Any idea what's happening?
EDIT: I can access after I restart my computer. But I'm still curious why about this happens. Also I use Cloud SQL with external IP for more information.
Okay next time I should read documentations more carefully:
Connection Reset Issue When using the local development server, you may get a connection reset error instead of a 413 response. You will get the correct status response when running the app with a production WSGI server.