Skip to content
Advertisement

Tag: flask

Flask-sqlalchemy: When to close sessions?

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

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

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

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

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,

Advertisement