def __init__(self): self.__mysql = MySQL() WBSV_AYD1.app.config['MYSQL_DATABASE_USER'] = '******' WBSV_AYD1.app.config['MYSQL_DATABASE_PASSWORD'] = '******' WBSV_AYD1.app.config['MYSQL_DATABASE_DB'] = 'proyectoClase' WBSV_AYD1.app.config['MYSQL_DATABASE_HOST'] = 'localhost' self.__mysql.init_app(WBSV_AYD1.app)
def __init__(self): self.app = Flask(__name__) self.mysql = MySQL() # mysql config self.app.config['MYSQL_DATABASE_USER'] = "******" self.app.config['MYSQL_DATABASE_PASSWORD'] = "" self.app.config['MYSQL_DATABASE_DB'] = "mastertestv2" self.app.config['MYSQL_DATABASE_HOST'] = "localhost" self.mysql.init_app(self.app)
class MySqlConfig: mysql = MySQL() def initDatabase(app): # MySQL configurations app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '******' app.config['MYSQL_DATABASE_DB'] = 'adwisedb' app.config['MYSQL_DATABASE_HOST'] = 'localhost' MySqlConfig.mysql.init_app(app)
def set_connection(app): mysql = MySQL() # MySQL configurations with open("project/credentials.txt", "r") as credentials_file: credentials = credentials_file.read().splitlines() app.config['MYSQL_DATABASE_USER'] = credentials[0] app.config['MYSQL_DATABASE_PASSWORD'] = credentials[1] app.config['MYSQL_DATABASE_DB'] = credentials[2] app.config['MYSQL_DATABASE_HOST'] = credentials[3] mysql.init_app(app) global conn conn = mysql.connect()
def test_search(self): _startdate = '2017-03-23' _starttime = '01:00 PM' _type = 'G' mysql = MySQL() # MySQL configurations app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '******' app.config['MYSQL_DATABASE_DB'] = 'lrrs' app.config['MYSQL_DATABASE_HOST'] = 'localhost' mysql.init_app(app) conn = mysql.connect() cursor = conn.cursor() cursor.callproc('sp_searchrooms', args=(_type, _starttime, _startdate)) assert cursor.rowcount == 1
def connect(): """connect user to DataBase on host""" host = "psotty.mysql.pythonanywhere-services.com" user = "******" pswd = "" database = "psotty$fitness" mysql = MySQL() # MySQL configurations app.config['MYSQL_DATABASE_USER'] = user app.config['MYSQL_DATABASE_PASSWORD'] = pswd app.config['MYSQL_DATABASE_DB'] = database app.config['MYSQL_DATABASE_HOST'] = host mysql.init_app(app) db = mysql.connect() return db
def setConfig(cls, app): mysql = MySQL() app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 app.config['MYSQL_DATABASE_USER'] = AccountBookRepository.getInstance( ).db_user app.config[ 'MYSQL_DATABASE_PASSWORD'] = AccountBookRepository.getInstance( ).db_password app.config['MYSQL_DATABASE_DB'] = AccountBookRepository.getInstance( ).db_database mysql.init_app(app) AccountBookRepository.getInstance().db_source = mysql #custom rule app.custom_id_min_length = 6 app.custom_password_min_length = 6 return app
from flask import Flask, render_template, request, json, session, redirect from flask.ext.mysql import MySQL from werkzeug import generate_password_hash, check_password_hash, secure_filename import os, pygame from Queue import * app = Flask(__name__) app.secret_key = 'why would I tell you my secret key?' mysql = MySQL() # q = Queue() q = [] current_song = '' prev_song = '' # MySQL configurations app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '******' app.config['MYSQL_DATABASE_DB'] = 'Music' app.config['MYSQL_DATABASE_HOST'] = 'localhost' mysql.init_app(app) import thread import threading lock = threading.Lock() def remove_elemnt():
from flask import Flask, render_template, flash, redirect, url_for, session, request, logging from flask.ext.mysql import MySQL import mysql.connector import Smart_Shopper_Lib_Tester as SSL from wtforms import Form, StringField, TextAreaField, PasswordField, validators from passlib.hash import sha256_crypt from functools import wraps app = Flask(__name__) #Config mysql app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '******' app.config['MYSQL_DATABASE_DB'] = 'smartshopper' app.config['MYSQL_DATABASE_HOST'] = 'localhost' mysql = MySQL(app) cust_id = 2 app = Flask(__name__) @app.route('/') def index(): return render_template('home.html') @app.route('/about') def about(): return render_template('aboutus.html')
def __init__(self, db_user, db_password, db_database): self.db_user = db_user self.db_password = db_password self.db_database = db_database self.db_source = MySQL()
def __init__(self, app): self.mysql = MySQL() self.mysql.init_app(app)
def __init__(self, app): self.mysql = MySQL() self.mysql.init_app(app) self.con = self.mysql.connect() self.cur = self.con.cursor()
from flask import Flask,g,render_template,request,jsonify import sqlite3 import database as db from flask.ext.mysql import MySQL from pymysql.cursors import DictCursor import ln2sql,os app = Flask(__name__) mysql = MySQL(cursorclass=DictCursor) # MySQL configurations app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '' app.config['MYSQL_DATABASE_DB'] = 'college' app.config['MYSQL_DATABASE_HOST'] = 'localhost' #app.config['MYSQL_DATABASE_PORT'] = 'localhost' mysql.init_app(app) @app.route('/') @app.route('/getResults',methods=['GET','POST']) def add_student(): if request.method == 'GET': return render_template('index.html') else: query = request.form['query'] print("gotcha",query) query = ln2sql.Ln2sql(database_path=os.path.join(os.getcwd(),'college.sql'),language_path=os.path.join(os.getcwd(),'english.csv')).get_query(query) #get title of course with student whose name is Shravan status = db.run_query(query)
# from flask import Flask (Step 1) # from flask import Flask, render_template # (Step 2) # from flask import Flask, render_template, request # adding to enable view of posted values (Step 5) from flask import Flask, render_template, json, request # adding for json use from flask.ext.mysql import MySQL # adding for mySQL use (Step 7) from werkzeug import generate_password_hash, check_password_hash app = Flask(__name__) mysql = MySQL() # (Step 7) # MySQL configurations (Step 7) app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '' # Update for testing app.config['MYSQL_DATABASE_DB'] = 'BucketList' app.config['MYSQL_DATABASE_HOST'] = 'localhost' mysql.init_app(app) @app.route("/") def main(): # return "Welcome!" (Step 1) return render_template('index.html') # (Step 2) @app.route('/showSignUp') # adds signup page to routes (Step 3) def showSignUp(): return render_template('signup.html')
# !/usr/bin/python # -*- coding: utf-8 -*- from config import config from flask import Flask from flask.ext.mysql import MySQL __author__ = 'AidChow' db = MySQL() def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) db.init_app(app) from .main import main as main_blueprint from .news import news as new_blueprint app.register_blueprint(main_blueprint) app.register_blueprint(new_blueprint, url_prefix='/news/api') return app
from flask import Flask from flask_restful import Resource, Api, reqparse from flask.ext.mysql import MySQL mySql = MySQL() app = Flask(__name__) app.config['MYSQL_DATABASE_USER'] = '******' app.config['MYSQL_DATABASE_PASSWORD'] = '******' app.config['MYSQL_DATABASE_DB'] = 'Your_Database_Name' app.config['MYSQL_DATABASE_HOST'] = 'localhost' mySql.init_app(app) api = Api(app) class CreateUser(Resource): #@app.route('/CreateUser', methods=['POST']) def post(self): try: parser = reqparse.RequestParser() parser.add_argument('FIRST_NAME', type=str, help='Enter First Name') parser.add_argument('MIDDLE_NAME', type=str, help='Enter Middle Name') parser.add_argument('LAST_NAME', type=str, help='Enter Last Name') parser.add_argument('USERNAME', type=str, help='Enter Username') args = parser.parse_args()