Skip to content

Instantly share code, notes, and snippets.

@serainville
Created June 6, 2019 12:49
Show Gist options
  • Save serainville/50b3e34160bf74ce4376de0fa217a8f1 to your computer and use it in GitHub Desktop.
Save serainville/50b3e34160bf74ce4376de0fa217a8f1 to your computer and use it in GitHub Desktop.
from flaskext.mysql import MySQL
import os
from flask import Flask
app = Flask(__name__)
mysql = MySQL()
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = os.environ['db_username']
app.config['MYSQL_DATABASE_PASSWORD'] = os.environ['db_password']
app.config['MYSQL_DATABASE_DB'] = os.environ['db_name']
app.config['MYSQL_DATABASE_HOST'] = '192.168.1.213'
mysql.init_app(app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment