Skip to content

Tag: flask

Adding CSS loader to HTML button click

I’m trying to add a “loader” while my flask application runs a task. Here is my HTML for for my button Here is the CSS that I’ve added: Any ideas on how to call this correctly? Answer Make it visible from the start, without ever showing it with javascript. Then hide it with js like so: EDIT: I now realize

Flask redirect without url params

I have 2 flask app, client and server respectively And I wanna download some files from server by redirecting user directly to the server So basically I want redirect to this route: So I’m write client like this: I wanna get url like: http://ipAddress/api/1.0/conf/myGreatToken But get: http://ipAddress/api/1.0/conf/%7B’token’:%20’myGreatToken’%7D And this doesn’t work. How to redirect without params? Answer It seems like

Inserting a request.form.items() list into a mongodb collection / Adding list of lists into mongoDB

I have the following code: I use for x in request.form.items() to loop through a dynamically generated form. Users create custom fields that can be added. I then add the results to a list of which an example of a print out is: [(‘name’, ‘David’), (‘phone’, ’90’), (’email’, ‘inf’), (‘company’, ‘Ran’), (‘Kids Names’, ‘Kids Names’), (‘Kids Birthday’, ‘2022-08-03’), (“Wife’s Email”,

Minimal Flask app unreachable from Docker container

I have a very simple flask service that I’m trying to run inside a docker container. I used python to implement a minimal application that is working fine on my Windows, but isn’t reachable when inside a Docker container. I tried the common fix of setting –host= (tried multiple ways), but it did not solve my problem. Project structure: ├──

Load data from Flask/Python to HTML textarea

I am trying to send data from Python / Flask to an HTML form textarea but need some help. responses.html is shown below. A portion of is shown below: I would like to display any previously recorded responses in the response textarea of responses.html while preserving the placeholder when no previous response was received from the user. Answer I