GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing flask-mysql.readthedocs.io — Flask-MySQL — flask-mysql 1.6.0 documentation Flask-MySQL¶Flask-MySQL is a Flask extension that allows you to access a MySQL database. You can report bugs and discuss features on the issues page. Installation¶Use pip to install pip install flask-mysql Configuration¶To configure access to your MySQL database server by using these settings :
Usage¶Initialize the extension : from flaskext.mysql import MySQL mysql = MySQL() mysql.init_app(app) Obtain a cursor : cursor = mysql.get_db().cursor() Multiple connection example: from flaskext.mysql import MySQL my_database = MySQL(app, prefix="my_database", host="hostname, user="username", password="password", db="my_database", autocommit=True) our_database = MySQL(app, prefix="our_database", host="hostname, user="username", password="password", db="our_database", autocommit=True, cursorclass=pymysql.cursors.DictCursor) @app.route('/') @app.route('/index') def hello(): my_cursor = my_database.get_db().cursor() #... our_cursor = our_database.get_db().cursor() #... | ||||||||||||
| You are visitor 01402622 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |