Skip to content
Advertisement

Tag: flask

Can I handle POST requests to Flask server in background thread?

I know how to receive data from POST request in main thread: But can I do that in background thread to avoid blocking UI (rendering index.html)? Answer I’m assuming you want the html rendering and processing of your request to run concurrently. So, you can try threading in Python https://realpython.com/intro-to-python-threading/. Let say you have a function that performs some processing

Is it possible to redirect inside a middleware class?

So I have a Middleware class that is supposed to get the cookies from the request and then send it to a function isAuthenticated which returns either True or False now if the function returns False I need to redirect to /login page is that possible to do? even though I don’t have the request object I only have the

Heroku getting at=error code=H10 while deploying python Flask web app

I am trying to deploy my first flask application in heroku. Followed steps exactly as mentioned in heroku documentation. But It is throwing Application error as shown below Project Structure wsgi.py file Procfile app/main.py requirements.txt runtime.txt Answer Welcome to Stackoverflow @vishnuvreddy Since you are deciding port using and mentioned –bind in Procfile as below conflict each other. Solution Change Procfile

Python Flask Executor | How to pass results from a background task to a currently active html page

To setup a simple html front-end and python flask back- Create a html script (index.html) and save D:Projectstest_backgroundtasktemplatesviews Create a python script and save D:Projectstest_backgroundtask: Code To create a background task, flask has a package called flask_executor Updated python script using excutor to create a background Required Output: Once the results are completed, the table containing test_val should be displayed.

Advertisement