Skip to content

Tag: flask

How to take dynamic input from flask and pass it to other function?

How can I take input from url in flask from the parameter? I need to take the above Id from input and pass it to other function without again needing to write “id” How can I directly use the id from give_id(id) function and feed it into vid_stream.get_hls_url function? Posting complete demo code, In case someone needs to run locally.

how to iterate over one field in jinja2

I have a database that looks like this: and I want to group the rows on country and display with something like this: The above doesn’t seem to work as the first for loop results in the following error: Is it possible to extract just one column, and use that to group the rows, just by using jinja2 (i.e. no

Python + pdfkit: Generate stream with pdfkit

I’m trying to use pdfkit to turn html pages into PDFs, and then return a stream of that PDF as this code is a Flask API called by a webpage. As far as I can tell, when you use pdfkit.from_file, you have provide both an input and output path: The problem is, I don’t want to write these files to

Atomic Code in gunicorn multiprocessing / only run code in worker 1?

I am new to gunicorn multiprocessing (by calling gunicorn –worker=X). I am using it with Flask to provide the WSGI implementation for our productive frontend. To use multiprocessing, we pass the above mentioned parameter to unicorn. Our Flask application also uses APScheduler (via Flask-APScheduler) to run a cron task every Y hours. This task searches for new database entries to

How to recalculate data from table in flask/python?

I want to show df in my app, im using flask to do it. But how can i make the table editable and calculated sum value by using button? I couldn’t found good and easy way to edit that html table, and somehow send it to backend to recalculate. Most tips i found abuot editables tables involve data from sql

Logger not creating logs on log file in flask application;

I want to create logs in my log file, logs can be shown on the terminal but not written on the log files. I created a package imp_calc which has templates and other files inside it, accessing it using which accesses the imp_calc package’s modules. My folder structure is as follows: my file My Routes Folder through which