Click here to Skip to main content
15,894,017 members
Everything / Web Development / Flask

Flask

flask

Great Reads

by Ahmed Bouchefra
Possible ways that you can use to connect or integrate Python with Node.js and Electron with simple examples
by SimbirSoft
A bit about Python & Flask

Latest Articles

by Ahmed Bouchefra
Possible ways that you can use to connect or integrate Python with Node.js and Electron with simple examples
by SimbirSoft
A bit about Python & Flask

All Articles

Sort by Updated

Flask 

20 Apr 2024 by OriginalGriff
actually running does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the...
24 Oct 2023 by Ranjeetha Ravindran Virdi
function getBathroomsValue() { var uiBathrooms = document.getElementsByName("uiBathrooms"); for(var i in uiBathrooms) { if(uiBathrooms[i].checked) { return parseInt(i)+1; } } return -1; // Invalid Value } ...
6 Aug 2023 by RAHUL(10217975)
I have deployed a Python in IIS, Application working fine in my local machine. I am able to retrieve project_id value from below request.form in local machine code but in IIS its not working. request.form['projectdetails[project_id]'] I am...
23 Jul 2023 by Dragynjump
I'm trying to deploy my website with heroku and I'm 90% of the way there. My problem is that when I try to deploy I get an error message that tells me flask_bcrypt isn't found. The reason is because it's not appearing in my requirements.txt file,...
23 Jul 2023 by Richard MacCutchan
See Deploying a Python Flask Example Application Using Heroku – Real Python[^]
23 Jul 2023 by Dragynjump
I'm looking to deploy a website I made using flask, but I need help finding the right web host. It contains a python configuration file, html files within a "templates" folder, a css page, several javascript files, and images contained within a...
23 Jul 2023 by Richard MacCutchan
See Deploying to Production — Flask Documentation (2.3.x)[^]
23 Jul 2023 by Graeme_Grant
I am not a python dev, so I did a quick search: flask web hosts - Google Search[^] and found this article: Top 10 Flask Hosting Providers | A Comprehensive Guide[^]. If you check the search, there are more...
19 Jun 2023 by RAHUL(10217975)
I am trying to deploy Python flask app in IIS python Code from flask import Flask # Create a Flask application instance app = Flask(__name__) # Define a route and a corresponding function @app.route('/') def hello(): return 'Hello, World!'...
19 Jun 2023 by Richard MacCutchan
Check that your settings match those that are listed at https://medium.com/@dpralay07/deploy-a-python-flask-application-in-iis-server-and-run-on-machine-ip-address-ddb81df8edf3[^].
17 Apr 2023 by vishanish
This issue has been resolved. Thank you for your help. I changed my original code to call and used the POST request for the delete_image endpoint.
13 Apr 2023 by Richard Deeming
You're making a GET request to the delete_image route, using an tag, so you won't be able to include hidden fields in the request. But endpoints which create, change, or delete data should never accept GET requests. Some browsers or...
31 Mar 2023 by OriginalGriff
Repost: Deleted. Please do not repost your question; use the Improve question widget to add information or reformat it, but posting it repeatedly just duplicates work, wastes time, and annoys people. I'll delete this one.
8 Mar 2023 by Mmachuene Maloba
how do I fix a terminal that does not import db when I enter: 'from app import db'? PS C:\Flask-Website> & c:/Flask-Website/.venv/Scripts/Activate.ps1 (.venv) PS C:\Flask-Website> python Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023,...
13 Feb 2023 by Josephine Anne Nacman
When we try to edit and delete a user in our crud, that error shows up. What I have tried: I don't know what step should I do
13 Feb 2023 by OriginalGriff
Without your code, we can't help specifically. Try here: SO: "InvalidRequestError: Object '' is already attached to session"[^]
7 Feb 2023 by Grace Clarke
I have created a program in python, which is an online store which users can add products to their cart and checkout etc. For the final part I want to finish it with it set up in flask for its own web page. from flask import...
3 Feb 2023 by j ton
I see this on web, I want to try myself but stock - .py (can get sql data and pass on index_test_0203.html) import mysql.connector import webbrowser import time import pymysql from flask import Flask,render_template,request app =...
3 Feb 2023 by Burhanchaudhry
Yes I trieed this solution in CMD prompt and this is the answer that it gave me, it gave me this as a result not to sure but I tried to execute the code and it didn't properly work out. The code you provided would just give me a repeated error...
2 Feb 2023 by Richard MacCutchan
I suggest you take a look at Welcome to Flask — Flask Documentation (2.2.x)[^], and work through the tutorial.
1 Feb 2023 by Chiranjib Parida
Showing Internal Server Error in flask python from prettytable import PrettyTable from flask import Flask, request app = Flask(__name__) @app.route("/", methods=["GET", "POST"]) class Structure_Cal: def __init__(self, Slope,...
10 Dec 2022 by Richard MacCutchan
Try the following change: return render_template('main/home.html', posts=posts) # add the 'main/' prefix to the template name. and the same for 'about'. [edit] Looking at the structure of my flask application I would suggest that all the...
10 Dec 2022 by Aalam Pratap Bedi
The error I'm getting- werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'home'. Did you mean 'main.home' instead? Code for my routes.py folder- from flask import render_template, request, Blueprint from...
10 Dec 2022 by CodeGuru84
It looks like the home function in your routes.py file is defined as part of a Flask blueprint named main. When using a blueprint, you need to prefix the endpoint name with the name of the blueprint when generating URLs using url_for. In your...
29 Nov 2022 by 74_Shubham Mourya [CO]
I am making cryptocurrency tracker and predictor web application for final year project. Can anyone please help me with what should i do:? We thought of making crypto tracker using APIs and predictive analysis model predicting the closing of...
29 Nov 2022 by Dave Kreskowiak
So how do you plan to predict the impact of social media posts of certain celebrities on the price of crypto? Yes, it happens, and that's why I don't gamble in crypto markets.
29 Nov 2022 by OriginalGriff
Quote: Hi, we have already taken this project as final year project, i am asking if this project is correct choice for a final year project If you have already decided, then that's a moot point. Is it appropriate in my opinion? No. Firstly, as...
29 Nov 2022 by Richard MacCutchan
Given the fact that you are asking other people to advise on how to make this project, I would suggest it is not a good choice. You should go for something that you already understand so you can get straight on with the actual design and coding.
13 Oct 2022 by meister meister
I have a function that the user can add a budget. In the python shell, when I am adding a budget there is no error. But when I am going for the route where I am adding my budget, it gets an error. This is the error I get: ...
22 Sep 2022 by lizp7
import _crypt ModuleNotFoundError: No module named '_crypt' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "E:\Learnbay deployment\deployment\main.py", line 2, in from...
22 Sep 2022 by OriginalGriff
Read the error message, it's really clear: The crypt module is not supported on Windows It's Linux specific, very simple, and not compatible with modern systems such as SHA (or even the broken MD5!). Think about exactly what you are trying to...
15 Sep 2022 by Apoorva 2022
I worked on an NLP project that can extract information from a resume like Name, Skills, Email, Designation etc. I built the project using Regular Expressions & stored the predictions in a variable. What I have tried: My prediction variable...
15 Sep 2022 by Richard MacCutchan
You can start at Welcome to Flask — Flask Documentation (2.2.x)[^] for creating a Flask application. But I have no idea how you integrate that in Colab.
2 Sep 2022 by Richard MacCutchan
Why have you posted this? It is exactly the same issue as R = request.get(url) attributeerror: 'request' object has no attribute 'get'[^], which I have already answered. Please do not repost the same question.
2 Sep 2022 by jon773599
My Flask code look like # A very simple Flask Hello World app for you to get started with... from flask import Flask,Response from flask import request from bs4 import BeautifulSoup import json app = Flask(__name__) if '_name_' ==...
2 Sep 2022 by Richard MacCutchan
You do not show which is line 15, but I cannot see a line like: r = request.get(url) However, I suspect what you need is: r = request.args.get(url) as you have in the above code. See also 3. Incoming Request Data — Flask API[^].
30 Aug 2022 by Aalam Pratap Bedi
{% for post in posts %} {{post title }} {{post author}} {% end for %} What I have tried: I am beginner in coding so i am just curios about this question.
30 Aug 2022 by Richard MacCutchan
That looks like the content of a flask template file, which is used to build a web page. See Welcome to Flask — Flask Documentation (2.2.x)[^]. However, if you are new to coding you may well find flask difficult to understand unless you have a...
25 Aug 2022 by Aalam Pratap Bedi
I have a folder named Python Project 01. It has 2 sub folders templates(for html)(it has two folders- home.html and about.html) and flaskblog (for python ) The code for my flaskblog is- from flask import Flask, render_template app =...
25 Aug 2022 by OriginalGriff
In Jinja, endif is one word, not two end if: Template Designer Documentation — Jinja Documentation (3.0.x)[^] {% if title %} Flask Blog - {{title}} {% else %} Flask Blog {% end if %} Should be: {% if title %}...
24 Aug 2022 by Aalam Pratap Bedi
im getting this error in flask - ERROR in app: Exception on / [GET] What I have tried: from flask import Flask, render_template app = Flask(__name__) posts = [ { 'author': 'Corey Schafer', 'title': 'Blog Post 1', ...
24 Aug 2022 by Richard MacCutchan
See Handling Application Errors — Flask Documentation (2.2.x)[^].
22 Aug 2022 by Member 15744868
Using flask SQLAlchemy and SQLite I have a database for a game. In this game I need to combine 2 elements to make a third. the first element comes from the column Main and the second is the name of a column where, in that row of main, the final...
22 Aug 2022 by OriginalGriff
Assuming that main, fire, water, air, and earth are your column names, it's simple: SELECT water AS Combination FROM MyTable WHERE Main = 'fire'
15 Aug 2022 by Prathmesh Upadhyay
-2 I am working with mongodb and python flask. Every time I run flask I receive this error on the local host and the terminal query = db.Data.find(upsert=True) AttributeError: 'NoneType' object has no attribute 'Data' What I have tried: ...
15 Aug 2022 by Richard MacCutchan
You need a method to get the database reference, the db variable does not exist in the functions you are using. See Welcome to Flask — Flask Documentation (2.1.x)[^] for details of how to do it correctly.
31 Jul 2022 by Jackie Lloyd
I have accepted this solution as it would be a good one if I hade correctly diagnosed the problem in the first place. (I also would give it 5 stars but for some reason it only seems to allow me to select 4). It actually turned out that the...
31 Jul 2022 by Jackie Lloyd
I have a python Flask app. If the user types characters into a search field fast then the wrong results can be displayed becuase there is a lag in getting the data. If another character is typed then the results are shown which are for the...
14 Jul 2022 by Kavya Bhargava
My form is receiving data when I put values in it but it is not displaying it in HTML. models.py: user = models.OneToOneField(User, on_delete = models.CASCADE) image = models.ImageField(default = 'default.jpg', upload_to =...
14 Jul 2022 by Dave Kreskowiak
You can't stop the event from firing. You can, however, check for a minimum string length in the textbox before firing the first search request. A typical minimum that I use is 3 characters. Next, your server-side code and database needs to be...
3 Jul 2022 by Kavya Bhargava
I built a simple signup form which will take data as user will click submit it will save it in database. But for some reason I am able to validate it. I removed all the validations and added again too. Not sure where I am missing? Forms.py: ...
2 Jul 2022 by Kavya Bhargava
I am new to Django, I was following a tutorial. I am trying to display my jobs from model.py to HTML Models.py: class Jobs(models.Model): FULL_TIME = 'FT' PART_TIME = 'PT' REMOTE = 'RT' TIER1 = 't1' TIER2 = 't2' TIER3...
2 Jul 2022 by Member 15678123
There a typo in the code {% for job in jobss %} Should be {% for job in jobs %}
27 Jun 2022 by Jackie Lloyd
I am new to Python and Flask, and have inherited some Python Flask code, and my task is to write tests for it - bad process I know but we are where we are :/ I have read lots of similar problems to mine but still none of them work in my...
22 Jun 2022 by Richard MacCutchan
Take a look at Testing Flask Applications — Flask Documentation (2.0.x)[^]
17 May 2022 by Tyrunt.new("Rix")
Hello, coding guys, As you saw in the title, my Python API returns a 404 page when a page is found, like /python/ should return "print("Hello, world!")", but returns 404 instead. This is my code: from flask import Flask, send_from_directory,...
6 May 2022 by Syed Ali Naqi 2022
I have deployed my App on Vertex AI endpoint. The endpoint is created successfully and I am getting "Active" status. But when I try to invoke the endpoint, I am getting the following error: { "error": { "code": 500, "message": "Prediction...
21 Apr 2022 by Kaushik Vezzu
As a part of my project involving conversion of sign language to english , I developed .tflite model and did predictions successfully using opencv. Now i want to implement web application for this . On the web page , there will be live streaming...
30 Mar 2022 by hemanth sravan
There is an APi1(master) which will randomly select number 2 or 3. If it is 2 it should call api2 and if it is 3 it should call api3. API1 should not wait for the response from api2. It should call api3 immediately .Once after the specific task...
8 Mar 2022 by bingusCoder
Hello there! I'm trying to make a website with a database, but when I commit an user's account to the DB, I get a sqlalchemy.exc.OperationalError I'm using flask to make the website. Is there anything I can do to fix this? Here is the code...
8 Mar 2022 by CHill60
As per my comment, you will need to generate the database from your model using the create_all method - see API — Flask-SQLAlchemy Documentation (2.x)[^] Also this reference might help : Quickstart — Flask-SQLAlchemy Documentation (2.x)[^]
8 Mar 2022 by lukeer
Hi forum, atm, I'm able to 1) Use Visual Studio Code's debugger on my flask socket.io application and 2) serve clients that are not my development machine but not both at the same time. To use the debugger, I just hit "F5" from within VSCode....
8 Mar 2022 by lukeer
Got it. That __name__ == "__main__" check fails when debugging because Visual Studio Code doesn't start app.py directly but something called launcher instead. VSC also passes launcher some obscure arguments that tell it to start and debug...
8 Mar 2022 by lukeer
Hi forum, there's an application ("the backend") using python flask socket.io. Multiple browsers ("the frontends") may connect to this application at the same time. One of the use cases requires that the backend sends a message to one of the...
15 Feb 2022 by Tasmiya Bano
I have a flask server running in background i.e. created a .service file and initiated the flask application. Now, when I fire flask APIs from launcher file, I am unable to see logger messages on console. I am doing this to add verbosity option...
22 Jan 2022 by Herme97
Hello everyone I want to slice a string on a flask template in python. Actually what I want to do is by using an if statement to make a link to something like "Read More" or just "..." I tried the following in html and flask files respectively...
7 Jan 2022 by Ebuoe
I just hosted my flask app for the first time online, everything seems to be working fine so far except for the sessions, which are not persistent. I have tested the app severally on my local server using the inbuilt flask and gunicorn server ....
24 Dec 2021 by Member 13969713
Well, I found a solution to this. It turned out, that the url provided in the form action section >http://localhost:8000/result should instead be /result so that it's a relative address instead of an absolute address.
24 Dec 2021 by Member 13969713
I am using an online IDE to test a flask project, but whatever I do, I get a web page that gives localhost refused to connect error. It happens when I submit a form, and it is supposed to redirect to another page. Further more, I tried to run...
12 Dec 2021 by Rakyat Monster
I am writing an application of RobotChat to be 24hours customer-service for answering the questions of the buyers/customers. I use Python, TelegramAPI, dan Flask. My program of this-application can work properly if I run it on local-computer...
6 Nov 2021 by Richard MacCutchan
Sorry no. This site does not provide free code conversion services.
3 Nov 2021 by Mahathir Mohammad Shuvo
I host a flask app in Ubuntu 18.04 LTS with Nginx and Gunicorn. I use Flask-SocketIO==5.0.1 for backend and "https://cdn.socket.io/3.1.3/socket.io.min.js" for front end. here is my server configuration: server { server_name toollaza.com; ...
22 Oct 2021 by Richard MacCutchan
See Tutorial — Flask Documentation (2.0.x)[^]
20 Sep 2021 by Thor Odinson 2021
I am trying to make a website which has solutions of a book (5 chapters). Firstly, I want to open chapters.html with route /chapters which displays five submit buttons and chapter no. as their values. And when the button is clicked,...
19 Sep 2021 by jcjakec
Sorry if this is a little vague. I have been attempting to use build a simple table. I have been following this tutorial, though when I run the site, the css doesnt seem to work. some parts do, for example the row colouring, but nothing else....
19 Sep 2021 by Richard Deeming
Quote: "> You've got an extra > on the end of your class name, which isn't valid. It should be: But looking at that code, I don't think much of the tutorial you're following. Using CSS...
1 Sep 2021 by Scieoner
The code itself: import redis, sqlite3, time from flask import Flask, render_template, request, g, current_app app = Flask(__name__) r = redis.Redis(host='localhost', port=5000, db=0) conn = sqlite3.connect('trade.db') cursor = conn.cursor()...
24 Aug 2021 by Richard MacCutchan
Try using the preferred port number for SMTP: https://www.mailgun.com/blog/which-smtp-port-understanding-ports-25-465-587/[^]. You should also check any response codes to see whether your calls succeeded or not: smtplib — SMTP protocol client —...
24 Aug 2021 by Dev-Elie
I am trying to send data from a contact form to email using python. I've tried several ways that don't seem to work. The data is from a random user, then the data should be forwarded to a specific email, not the same email receiving the message...
22 Aug 2021 by G V Naik
On Login of my Application by default the frontend shows 20 columns and also there is a dropdown for user selection of these columns to show only columns user is interested working on instead of all 20. Suppose the user selects 5 columns and...
25 Mar 2021 by Saurabh Nadar
I am making a dynamic blog using flask but when i try to connect to the databse i get the error in the title. Here's my code. from flask import Flask, render_template, request from flask_sqlalchemy import SQLAlchemy from datetime import datetime...
25 Mar 2021 by Saurabh Nadar
I found the problem. Somehow “SQLAlchemhy” was not working properly. So i only had to uninstall and reinstall it. Giving this answer so that it could be helpful for someone in future.
22 Mar 2021 by nainish aggarwal
Here is my code for searching a keyword in Docx files present in the folder. It should show all the Docx files which contain the keyword. But here when I use AutoIndex it only showing the whole directory as the output and I want that the...
18 Mar 2021 by lukeer
Hi forum, there is a python program using flask and socket.io to create a web server which runs on my development machine. On the same machine, I can access the server and get the website it serves by typing localhost:5000 in the address field...
18 Mar 2021 by lukeer
In an attempt to find out how other web servers on the same machine would be treated, I started$ winpty python -m http.server 5000 (Found that somwhere in the internet). That triggered the firewall to tell that it had just blocked python.exe and...
17 Mar 2021 by meister meister
I have a function that output Average Budget and Average Salary, the problem is when the computation executed for the average salary, also the average budget affected. I tried to use simple .copy() routes.py: @app.route("/user/",...
10 Mar 2021 by lukeer
Hi forum, to use Socket.IO, our server has to use a library called flask_socketio. Its clients will be browsers. They need a Socket.IO implementation, too. Therefore, the index.html that the server distributes includes
2 Mar 2021 by jaideepsinh
I am trying to create an azure ci/cd pipeline for my python application. I have tried many ways but not get success. I can create CI successfully even in some cases cd also but not able to see the output on the azure app service. I use Linux app...
2 Mar 2021 by jaideepsinh
Solved by configuring the steps as mentiond in below post: flask - Azure devops for Python - Stack Overflow[^]
24 Feb 2021 by Richard MacCutchan
Did you try Welcome to Flask-SocketIO’s documentation! — Flask-SocketIO documentation[^] ?
22 Feb 2021 by Aymal Khalid Khan
Webhook is created in Flask and hosted on the google cloud Platform. Link to the web hook URL. https://webhook-app-305615.df.r.appspot.com/ Payload To be received: { "uri" : "https://webhook-app-305615.df.r.appspot.com/", "data" : { ...
22 Feb 2021 by lukeer
Hi forum, a colleague of mine has created a marvellous piece of HTML and CSS that leaves me astonished what UIs are possible with web programming skills. I am responsible for the backend in python. I have a connection to a real-world...
21 Jan 2021 by pythonHumanBot
Hey guys, I'm trying to sum the rows of the products cost into the portfolio table, so I inserted a refresh button in my flask page to do that that calls this function. I need the sum part to work, and then I can safely add the commit to the...
21 Jan 2021 by pythonHumanBot
I changed the button from a href to bootstrap modal fixed the 404 error, thank you again Christian!
21 Jan 2021 by Christian Graus
The URL is wrong. There is no URL in your code, ergo, your code is not the issue. You need instead to use your debugger. Why on earth would you not calculate this with sql using SUM?
19 Jan 2021 by Fynn Pfingsten
if i run this code: from flask import render_template import connexion # Create the application instance app = connexion.App(__name__, specification_dir='./') # Read the swagger.yml file to configure the endpoints app.add_api('swagger.yml') ...
20 Sep 2020 by Member 13998042
how to serializ the date time object in python api i have a api which will give json output and i am trying to save it as excel using xlsxwriter and i am getting this error Object of type datetime is not JSON serializable this is the api...
20 Sep 2020 by Sandeep Mewara
Generally, using of json.dumps with a custom converter. Quote[^]: The json.dumps method can accept an optional parameter called default which is expected to be a function. Every time JSON tries to convert a value it does not know how to convert...
20 Sep 2020 by OriginalGriff
Have a look here: Python Serialize Datetime into JSON[^]