Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
I'm working on a simple Flask project. But when I try to work with the database I got an error called "No module named MySQLdb". I also got error when I try to install "mysql clint" with this command:-pip install mysqlclient. So I searched for the solution of this problem but every time I find someone told to download "MySQL client" from this website:-
https://lfd.uci.edu/~gohlke/...
But the "MySQL client" file is no longer available on that website.
please help me by giving that file or any other way. You can also check my project from here:-
https://drive.google.com/file/d/...
unfortunately, my operating system is Android 6.0
Here is the code:-
from flask import Flask,render_template, request
from flask_sqlalchemy import SQLAlchemy
app= Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://localhost/codingthunder/"
db = SQLAlchemy(app)
class Contacts(db.Model):
sno = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), nullable=False)
phone_num = db.Column(db.String(14), nullable=False)
mes = db.Column(db.String(120), nullable=False)
date = db.Column(db.String(12), nullable=False)
email = db.Column(db.String(20), nullable=False)
@app.route("/home")
def home():
return render_template("index.html")
@app.route("/about")
def about():
return render_template("about.html")
@app.route("/contact", methods=['GET','POST'])
def contact():
if(request.method=='POST'):
name=request.form.get('name')
email=request.form.get('email')
phone=request.form.get('phone')
message=request.form.get('message')
entry=Contacts(name=name,phone_num=phone,mes=message, date="2019-09-01 12:06:20", email=email)
db.session.add(entry)
db.session.commit()
return render_template("contact.html")
@app.route("/post")
def post():
return render_template("post.html")
app.run(debug=True)
question
flask
mysql
python 3