Questions tagged [flask-mysql]
103 questions
0
votes
1 answer
How to make a choices field in Flask like we have in Django?
I have a model in which one of the fields is a role, I want the model to accept one role out of two roles something like a manager or staff.
In Django for this, we have CHOICES, how we can implement it in Flask?
0
votes
0 answers
Flask upload and display images from MYSQL
Im working on a website by using Flask. In database my image type blob and Im using flask-mysql library. I want to upload image to the database and display from there but when I trying to display, my output is None in 'goster.html'
Here is my…

Adeon
- 1
- 1
0
votes
1 answer
How do you check if a table contains data? (Python Flask MYSQL)
How exactly do you check if a table contains a specific value? For example,
if request.method == 'POST':
email = request.form.get("email")
cur = mysql.connection.cursor()
cur.execute("SELECT * from login_info")
data =…

emergenitro
- 1
- 1
- 2
0
votes
2 answers
Problem with Flask Blueprints, can´t remove the /home route, or app crashes
Hi there I'm creating a Flask web app and now I have to create more cruds, so I decided to modularize the app using Blueprints.
I have a Login function on main.py that allows me to enter the app interface:
app.route('/', methods=['GET', 'POST'])
def…

Cromewar
- 155
- 9
0
votes
1 answer
Cannot retrieve data from my flask CRUD application from mysql table even though its getting inserted without any error
Here's the python snippet
@app.route('/oxygenadmin')
@is_logged_in
def oxygenadmin():
cur=mysql.connection.cursor()
cur.execute("SELECT * FROM oxygen")
data =cur.fetchall()
cur.close()
return render_template('oxygenadmin.html',…

Abhishek Krao
- 1
- 2
0
votes
1 answer
I'm new to flask-mysql. I'm having trouble in making Pagination API for the list view. Please look in to it
Below is the view function of property view, and I would like to add pagination to this.
class PropertyView(Resource):
def get(self):
try:
data = request.json
verifyJwt= request.headers.get('Authorization')
token =…
0
votes
1 answer
Python & Flask error using Flask-MySQL | Module Not Found Error: No module named 'flask_mysqldb'
In my system, I installed the flask_mysqldb, however when I run the app.py file it shows an error like nomodule named flask_mysqldb.
I tried another way of downloading mysqlclient and installed it, but the same error occurs.
Error
The error is …

KSM
- 1
0
votes
1 answer
How i could Column names in response from cursor in Python Flask APP?
I´m developing a API on Python 3 using Flask and trying to insert data to Mysql, but on the response only comes the values and I can't show properly on the Json answer to app.
Python Code
app = Flask(__name__)
app.config['MYSQL_HOST'] =…

Simón López
- 3
- 3
0
votes
0 answers
how to download Flask-MySQLdb
I'm currently downloading Flask -MySQLdb to work on a log-in system project as a beginner, but when I tried to install it, it kept giving me this error, which I had no idea how to solve it.
Collecting Flask-MySQLdb
Using cached…

Soo
- 33
- 1
- 6
0
votes
1 answer
Error installing mysqldb: Could not find a version that satisfies the requirement flask-mysqldb
The error i receive
I get this error trying to install mysqldb with pip. I got a response that I damaged the python files and should remove and re-install python on a different website. So I removed python via the control panel and downloaded it…

Berkay
- 1
- 1
0
votes
0 answers
Is it possible to retrieve and post data in same form?? python flask and MySQL
I have a python flask form. Where in first input field with search button when I enter the id and click button it should fill the remaining fileds retriving from database. and then if ok it should be edited and then again on submit it needs to be…

prem
- 1
0
votes
1 answer
MySQLdb._exceptions.OperationalError: (1054, 'Unknown error 1054')
1.when I'm updating I get this error
try:
cur=db.cursor()
print("update cur",cur)
cur.execute('''UPDATE ast_details SET Asset_ID=%s,Make=%s,Model_No=%s,Serial_No=%s,
…

Deepak kumar debug
- 375
- 3
- 7
0
votes
1 answer
How to get only the value from the SQL query output without parentheses
Here is my code in the flask app
from flask import Flask, render_template
from flask_mysqldb import MySQL
import MySQLdb.cursors
app = Flask(__name__)
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] =…

Sreenath Kumar
- 13
- 4
0
votes
1 answer
How to get multiple items from the same field - Flask MySQL
I'm doing a small App with Flask and MySQL. I'm trying to show certain items in a table, but I would like to filter these items based on only 1 field of the database.
This example is doing what I need, but only if my list has 2 items. And the idea…

karvis6974
- 1
- 1
0
votes
0 answers
Flask: Executing multiple queries
I'm building a webapp, and one of my .py files keep a lot of SQL functions. These functions connect to the database, execute the query, fetch the result and close the connection.
Example:
def get_user_data():
conn = MySQLdb.connect(host, port,…

Raphael Vale
- 9
- 2