I basically want to go to a different page after the upload. What happens here is that the file is uploaded very quickly and saved on the server, but after that the client(my browser) is in the Waiting stage for a minute each time and doesn't even redirect after the wait. If I remove it, I don't get any response back as expected and everything happens within milliseconds.
@blah.route('/upload', methods=['GET', 'POST'])
def upload():
if request.method == 'POST' and 'file' in request.files:
file = request.files['file']
if file:
filename = secure_filename(file.filename)
file.save(os.path.join('./tmp/uploads', filename))
print '%s file saved' % filename
return redirect(url_for("blah.list_uploads"))
return render_template('blah/upload.html')
Edit: Not sure if it will help to say that I'm using DropzoneJS. I think by default it uses Ajax. Maybe it has something to with that?
url_for
. I'm guessingblah
isn't the name of your blueprint so I'm not sure if that was just an omission when you were creating this question. – Passingreturn redirect(url_for("blah.list_uploads"))
? Nothing else? It looks conspicious that it's exactly one minute. Maybe all workers (or more probably you are running only a single worker) are busy with something else, for example long-polling AJAX call. – Ramrod