Skip to content
Advertisement

Tag: flask

Flask unable to send image back in json response

Attempting to send an image to the client browser – the following code works perfectly – please assume that I am receiving the correct base64.b64encoded byte stream: On my development box. Move it to a flask production running under gunicorn and I get JSON serialization errors: TypeError: Object of type bytes is not JSON serializable I am also getting this

Flask form validation – CSRF token middleware

I have an html form, and I would like to insure that all submissions come from my website. I think I have seen people using a key for this (I believe this happens in Django?), and might have some ideas on how to go with that. Is there any standard way to do this in Flask? Edit: Now I know

How can Jinja2 read a function without passing it explicitly?

In the flask:flashing documentation, I encounter the following situation. And here is the Jinja2 used HTML file. So I wonder that even if there is no function passed in to the HTML file by using return statement in Python file, Jinja2 can read get_flashed_messages() function, which is a function under the flask module. How is this possible? Answer Messages to

Flask testing with pytest, ENV is set to production?

I have built a flask app and i would like to create a test suite. Reading around it looks like pytest is the way to go; however, I am finding it very difficult to understand how to get going, I have looked at https://flask.palletsprojects.com/en/2.0.x/testing/ but am struggling to relate it to my app. my project has a run.py at its

Flask and Ldap3 not playing nicely together

I’m building an internal app for my company, and are looking into using ldap3 to connect to our exchange server to validate login credentials. I am integrating into a flask app and have a login view with the following code The above code works fine when I login using my actual credentials, but when I try to login using wrong

Unable to execute a query on flask using MqSQL

Hello there im trying to execute a SQL query using Flask with mysqldatabase, the query returns as a JSON managed my JQuery on the front end. The goal is to use a search bar to find any matches with the data base. The query works just fine if I use just one “like” sentence, for example. But in the moment

Advertisement