Skip to content
Advertisement

page of FLASK app is not changing after uploading a file, progress bar works fine

I want to perform some analysis on a text file. Once file is uploaded in the webpage, I am trying to redirect the route, But that isn’t working. Surprisingly, print statement is running in the console of the redirected route, but the template isn’t rendering.

Debug mode is true, I have multiple times ran this command set FLASK_DEBUG=1. I desperately need help :( Any help will be really appreciated.

imo there is some issue in javascript, which is not letting python change url.

My front end page is

JavaScript

and python page is

JavaScript

Advertisement

Answer

If you use JavaScript/AJAX to send request then response is send to this JavaScript code – and JavaScript’s request is redirected to /dummyroute and JavaScript gets response from /dummyroute but browser will not try to use this response to redirect full page.

AJAX was invented to NOT reload full page and browser doesn’t reload/redirect page when you use AJAX.

You will have do redirect full page directly in JavaScript – document.location = '/dummyroute'

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement