Skip to content
Advertisement

Tag: flask

Contained submit button validating other forms

I have two forms on my page, each with its own fields and submit button, but whenever I use any of them, they always check the overall page fields instead of just the form they’re contained in… The simulator.html has two forms, the first one is this: And the second one is this: The views.py file has the back-end code

Can i have two different sets of app configurations?

I have made a flask server REST API that does an upload to a specific folder. The upload must comply to a specific file extension, and must be in a specific folder. So i made these two app.configs: However, i want to make a new route, for a new upload of a specific file extension to another folder. So can

werkzeug.routing.BuildError: Could not build url for endpoint ‘profile’. Did you mean ‘index’ instead?

I’m new to programming and I’m following this tutorial: https://www.youtube.com/watch?v=SUC1aTu092w&ab_channel=edureka%21 | I’m trying to make a login system using flask and MySQLdb and I’ve run into this problem, I’m so confused. There’s nothing wrong with the database, I’ve checked multiple times. I’m using VS code. Error: werkzeug.routing.BuildError: Could not build url for endpoint ‘profile’. Did you mean ‘index’ instead? app.py

More elegant way to call arbitrary Python functions from Flask

Setting up a Flask REST API is easy. I use the following approach: In this example I import functions sitting inside utility.py: This allows me to pass any function name as an argument and get the result back. So if I ran the following in my browser: I would see: The way I process the request is quite bloated. You

Working outside of application context Flask JWT decorator issue

I am fairly new to Flask applications. While my application works for all the endpoints as expected when I tried to add jwt authorization I encountered this issue. I have tried this solution app.app_context().push() based on some other questions that have been posted. Any help would be greatly appreciated. I would also like to use the decorator in multiple apis,

Creating list of dictionaries from txt using values from for loop

Need to create a list of dictionaries with keys ‘Date’ and ‘Value’. The values of keys are stored in a txt file with following structure: The outputs with below code is {“01-01-2020 12:00:00″:”10”, “01-01-2020 13:00:00″:”9”}… What I would like to do is [{“Date”:”01-01-2020 12:00:00″,”Value”:”10″},{“Date”:”01-01-2020 13:00:00″,”Value”:”9″}…] Any help would be much appreciated, thanks. Answer Currently, you have created the dictionary object

Blueprints in Flask vs Apps in Django [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question I am new to Flask and noticed something called Blueprint in Flask. I searched it and now I am using it

Advertisement