Category : flask-mysql

I’ve been trying to install flask-mysqldb in python 3.8 using pip install flask-mysqldb, but every time I try it gives me an error that says The error is: $ pip install flask-mysqldb Requirement already satisfied: flask-mysqldb in c:usersroshanappdatalocalprogramspythonpython38-32libsite-packages (0.2.0) Requirement already satisfied: Flask>=0.10 in c:usersroshanappdatalocalprogramspythonpython38-32libsite-packages (from flask-mysqldb) (1.1.2) Requirement already satisfied: mysqlclient in c:usersroshanappdatalocalprogramspythonpython38-32libsite-packages (from ..

Read more

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’, oxygen=data) @app.route(‘/insert’, methods=[‘POST’]) @is_logged_in def insert(): if request.method == ‘POST’: name = request.form[‘name’] contact = request.form[‘contact’] email = request.form[’email’] place = request.form[‘place’] cur = mysql.connection.cursor() cur.execute("INSERT INTO oxygen(name, contact, email, place) VALUES (%s, %s, %s, %s)",(name,contact,email,place)) mysql.connection.commit() ..

Read more

I am trying to deploying a flask application which uses mysqlclient module. I added "mysqlclient==2.0.3" in the requirements.txt file but it is giving me an error as mentioned: Hoping to get a solution in order to resolve this and deploy my application. *Collecting mysqlclient==2.0.3 Downloading mysqlclient-2.0.3.tar.gz (88 kB) 2021/04/30 14:51:41.371493 [ERROR] An error occurred during ..

Read more

I’m getting this error upon sending a POST request to my REST API. Anyone know what this means? I am using flask mysql instead of SQL alchemy Detected change in ‘C:UsersUser-PCDesktopPython APImodels.py’, reloading Restarting with stat Debugger is active! Debugger PIN: 114-398-217 Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) {‘username’: ‘ah’, ‘password’: ‘oh’} 127.0.0.1 – ..

Read more

I am using Windows10 Home,I have Python3.9.1 and Visual Studio Code.These are mu code: from flask import Flask,render_template,flash,redirect,url_for,session,logging,request from flask_mysqldb import MySQL from wtforms import Form,StringField,TextAreaField,PasswordField,validators from passlib.hash import sha256_crypt class RegisterForm(Form): name = StringField("Name Surname",validators=[validators.Length(min=4,max=25)]) username = StringField("User name",validators=[validators.Length(min=5,max=35)]) email = StringField("Email Adress",validators=[validators.Email(message = "Please enter a valid email.")]) password = PasswordField("Password:",validators=[ validators.DataRequired(message = ..

Read more

I’m making a database website and have a search form on my page which when you search a particular name, creates a dynamic url for that name and uses information from my database to fill in the template. Here’s my code: @app.route(‘/’, methods=[‘GET’, ‘POST’]) def index(): if request.method == "POST": book_database= request.form[‘book_database’] return redirect(url_for(‘book"’, book_name ..

Read more