HOME/Articles/

mysql example pythonProject project init (snippet)

Article Outline

Python mysql example 'pythonProject project init '

python pythonProject project init

Python mysql example: pythonProject project init

from flask import Flask
from flaskext.mysql import MySQL

mysql = MySQL()
app = Flask(__name__)

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'root'
app.config['MYSQL_DATABASE_DB'] = 'project'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
app.config['MYSQL_DATABASE_PORT'] = 8889
mysql.init_app(app)

conn = mysql.connect()
cursor = conn.cursor()

from . import login
from . import register