I have created a python webapp with Flask and it seems like I am having connection issues with the database. I think this is because I don’t close my sessions somewhere in my code. I have for the database and use for adding records to the database. When do I have to close my session in this case? Is there
Tag: flask
Stream OpenCV Video Capture to flask server
Greeting, I was working on a drone project, I wanted to take stream from my drone process it on my laptop and give a command based on processing, I was using the flask framework from the same. Currently, as the first step I want to take the stream from drone and PUT it to the flask server and view it
How to mock out AWS resources when testing flask app
I have a Flask app that uses AWS services such as dynamodb. I want to mock these out during unit tests but I’m having trouble doing so. Here is a minimal example that doesn’t work for me: I’m getting an error that the resource does not exist. This means that an AWS call is in fact being made. Why isn’t
Flask handling multiple errors
I have a simple app made in Flask. It uses only POST method. It takes 2 numbers (in json) and adds them up. The application responds with the sum of these numbers (also in json). The code looks like this: I would like to do error handling. The problem is that there are a lot of these errors, e.g. for
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
How to call a variable outside a validate() function which is inside the FlaskForm class
I have two def validate(self) functions within the RegistrationForm(FlaskForm). First function validates the user input if the car range is over 400km. The other function validates if the user lives far or close to work by calculating the distance between the user’s address and work address by means of geopy module. I’ve been told that def validate_field(self, field): function takes
Challenge value not responding when connecting to request URL using python
I am trying to connect to my request URL in slack but it does not respond with the challenge value like it is supposed to. This has never been an issue before and I have not changed the code so i’m very confused why I have this. There is no message in the ngrok terminal either or the python code
Flask_SQLAlchemy is claiming my value is not boolean?
I ran into the following error: I tried as boolean input everything ranging from 0|1, FALSE|TRUE, False|True on my main route. I have also tried to put in the boolean values inbetween quotations. What am I doing wrong? My base route being as follows Answer The problem you have is that the form submission is returning the selection value as
Hide div element using python in Flask
I have a div element on ticket.html as <div class=”rgrp” style=”visibility:hidden”>….<div> So on page /ticket is the form which on submitted redirect to same page as /ticket# Answer In your template for ticket.html you could put something like this: Then when you’re calling your render template, you can do something like this: If you need to make it visible later,
What is the correct way to handle queries for a Flask RESTful endpoint?
I am creating an API using Flask-RESTful, and am attempting to make a resource that returns all items in a database that are like a user defined string. The endpoint for this resource is defined as: And the resource itself is: The problem is that when I send a GET request to the endpoint http://127.0.0.1:5000/privateapi/item?query=appl I get a 404 response.