Apr-13-2021, 12:10 PM
There is no reason to use phpMyAdmin/XAMPP when using Flask,i would never use it this Python usage not PHP.
The standard way to deal to with database in Flask is to use Flask-SQLAlchemy.
Then use DATABASE_URI to connect to database of choice.
So the setup could look like this.
The standard way to deal to with database in Flask is to use Flask-SQLAlchemy.
Then use DATABASE_URI to connect to database of choice.
So the setup could look like this.
from flask import Flask from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://username:password@server/db' db = SQLAlchemy(app) class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) def __repr__(self): return f'User {self.username} Email {self.email}'Can look this post there you see a full setuo using sqlite3 so only one line
URI
change to eg switch to use MySQL.