I am trying to access mysql database in xampp server using flask_sqlalchemy
my code is as follows
from flask import Flask , render_template , request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.secret_key = "secreat key"
app.config['SQLALCHEMY DATABASE_URI'] = 'mysql://root:@localhost/cust_51_stock_list'
app.config['SQLALCHEMY TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class Stocks(db.Model):
id = db.Column(db.Integer, primary_key = True)
tiker = db.Column(db.String(15))
price = db.Column(db.String(20))
qty = db.Column(db.String(20))
@app.route('/')
def home():
tkrs = Stocks.query.all()
all_data = ['1','2','3','4','5','6','7']
return render_template('home.html', stk_data=tkrs)
# @app.route('/getdata', methods = ['POST'])
# def send_data():
# if request.method == 'POST':
if __name__ == "__main__":
app.run(debug=True)
when I try to access it in html its showing error "sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table"
where I have database "cust_51_stock_list" and table "stocks"
please help