My app makes a call to an API that returns a dictionary. I want to pass information from this dict to JavaScript in the view. I am using the Google Maps API in the JS, specifically, so I’d like to pass it a list of tuples with the long/lat information. I know that render_template will pass these variables to the
Tag: flask
How do I get my HTML button to delete the right list item from a SQLite database?
I’m a beginner, so forgive any stupidity in advance. I’m using Flask (and by extension Jinja2) to create a simple web app — one that basically lets you type a movie into a web form, which adds it to a SQLite database. I’ve gotten Flask to very nicely iterate through all the movies in the database and print them to
Flask POST request is causing server to crash
I am trying to make a simple api in Flask, the first step being getting the POST json data. (I just want to print it for now) This is my code and when I request /api with json data, it returns a 500 error. Any thoughts on why this is happening? The curl command: body.json: Answer First what you want
How do I get the user agent with Flask?
I’m trying to get access to the user agent with Flask, but I either can’t find the documentation on it, or it doesn’t tell me. Answer You can also use the request.user_agent object which contains the following attributes which are created based on the useragent string: platform (windows, linux, macos, etc.) browser (chrome, firefox, msie, etc.) version language string (==
Create dynamic URLs in Flask with url_for()
Half of my Flask routes requires a variable say, /<variable>/add or /<variable>/remove. How do I create links to those locations? url_for() takes one argument for the function to route to but I can’t add arguments? Answer It takes keyword arguments for the variables: The flask-server would have functions:
Great flask / other python micro framework code I could learn from [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 1 year ago. Improve this question I’d like to look at some good web-app code written in
Using Python, getting the name of files in a zip archive
I have several very large zip files available to download on a website. I am using Flask microframework (based on Werkzeug) which uses Python. Is there a way to show the contents of a zip file (i.e. file and folder names) – to someone on a webpage – without actually downloading it? As in doing the working out server side.