def app_conf():
	app = Flask(__name__)
	app.config['MYSQL_DATABASE_USER'] = 'be19b22964899a'
	app.config['MYSQL_DATABASE_PASSWORD'] = '9429117f'
	app.config['MYSQL_DATABASE_DB'] = 'heroku_af0d793d9f3ef4f'
	app.config['MYSQL_DATABASE_HOST'] = 'us-cdbr-iron-east-03.cleardb.net'
	app.secret_key = "Estodeberiaserandom"
	return app
Example #2
0
 def conexion(self):
     mysql = MySQL()
     control = Flask(__name__)
     control.config['MYSQL_DATABASE_USER'] = 'wtec_dev'
     control.config['MYSQL_DATABASE_PASSWORD'] = 'wtec123'
     control.config['MYSQL_DATABASE_DB'] = 'wtec_webapp'
     control.config['MYSQL_DATABASE_HOST'] = '192.168.227.135'
     mysql.init_app(control)
     return mysql
Example #3
0
def create_connection():
	mysql = MySQL()
	app = Flask(__name__)
	app.config['MYSQL_DATABASE_USER'] = 'root'
	app.config['MYSQL_DATABASE_PASSWORD'] = ''
	app.config['MYSQL_DATABASE_DB'] = 'virball'
	app.config['MYSQL_DATABASE_HOST'] = 'localhost'
	mysql.init_app(app)
	con = mysql.connect()
	return con
Example #4
0
def create_app(config='CTFd.config'):
    app = Flask("CTFd")

    with app.app_context():
        app.config.from_object(config)

        from CTFd.models import db, Teams, Solves, Challenges, WrongKeys, Keys, Tags, Files, Tracking, mysql

        app.config['MYSQL_DATABASE_USER'] = 'root'
        app.config['MYSQL_DATABASE_PASSWORD'] = 'root'
        app.config['MYSQL_DATABASE_DB'] = 'EmpData'
        app.config['MYSQL_DATABASE_HOST'] = 'localhost'
        mysql.init_app(app)

        cursor = mysql.connection.cursor()
        

#        cursor.execute('CREATE DATABASE  IF NOT EXISTS info_sec;')
#        cursor.execute('USE info_sec;')        
#        cursor.execute('CREATE TABLE IF NOT EXISTS info_sec.security_table \
#        (\
#        username varchar(255),\
#        pass char(255));')



        db.init_app(app)
        db.create_all()

        app.db = db

        #Session(app)

        from CTFd.views import views
        from CTFd.challenges import challenges
        from CTFd.scoreboard import scoreboard
        from CTFd.auth import auth
        from CTFd.admin import admin
        from CTFd.utils import init_utils, init_errors, init_logs

        init_utils(app)
        init_errors(app)
        init_logs(app)

        app.register_blueprint(views)
        app.register_blueprint(challenges)
        app.register_blueprint(scoreboard)
        app.register_blueprint(auth)
        app.register_blueprint(admin)

        return app

# create the application object
app = Flask(__name__)
#VARIABLE REQUIRED FOR ADMINISTRATOR MODULE
PAGE_LIMIT=10;


## set up connection to the database

mysql = MySQL()
db = SQLAlchemy(app)
app.config['SQLALCHEMY_DATABASE_URI'] = propertiesparser.getDatabaseSQLAlchemy()

app.secret_key = 'F12Zr47j\3yX R~X@H!jmM]Lwf/,?KT'
app.config['MYSQL_DATABASE_USER'] = propertiesparser.getDatabaseUserName();
app.config['MYSQL_DATABASE_PASSWORD'] = propertiesparser.getDatabasePassword();
app.config['MYSQL_DATABASE_DB'] = propertiesparser.getDatabaseName();
app.config['MYSQL_DATABASE_HOST'] = propertiesparser.getDatabaseHost();
mysql.init_app(app)
bootstrap = Bootstrap(app)
moment=Moment(app)
role = ''

## section for the login and registration modules
@app.route('/login')
def login():
	session.pop('username', None)
	return render_template('/login/login.html',title="ENABLE INDIA - LOGIN")
	
@app.route("/logout")
#! python3 

from flask import Flask
from flask import render_template
from flaskext.mysql import MySQL

mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'interview'
app.config['MYSQL_DATABASE_PASSWORD'] = 'interview'
app.config['MYSQL_DATABASE_DB'] = 'interview'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)

@app.route('/')
def index():	
	return render_template('home.html', arg="My Python Solution")

if __name__=="__main__":
    app.run(host='0.0.0.0', port=8080,debug=True)
Example #7
0
# -*- coding: utf-8 -*-
import os

from flask import Flask
from flaskext.mysql import MySQL
from routes.login_routes import login_r
from routes.usuario_routes import usuario

tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'views')
app = Flask(__name__, template_folder=tmpl_dir)
app.secret_key = 'proyecto_ufps'
mysql = MySQL()

# import routes
app.register_blueprint(login_r)
app.register_blueprint(usuario, url_prefix="/usuarios")

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

if __name__ == "__main__":
    app.run(debug=True)
Example #8
0
#!usr/bin/python

#create the application instance
from flask import Flask
#from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__) #Flask will use this to determine root path of the app so it can find resource files relative to the app
app.config.from_object('config')

#database

mysql = MySQL()

#mysql conigurations
app.config['MYSQL_DATABASE_USER'] ='larrisa'
app.config['MYSQL_DATABASE_PASSWORD']= 'hkilel07'
app.config['MYSQL_DATABASE_DB'] = 'Bucketlist'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)
#db is the database
#db = SQLAlchemy(app)

#from app import views,models
from flask import Flask, render_template,request, json #as the name suggests, we use it to render our template
#define basic route and it's corresponding request handler
@app.route('/')
def main():
    return render_template('index.html')

@app.route('/showSignUp')
def showSignUp():
    #read posted values from the UI
Example #9
0
from flask import Flask, render_template, json, request
from werkzeug import generate_password_hash, check_password_hash
# pip install flask-mysql (Mac/Linux)
# pip install Flask-MySQL (Windows)
from flaskext.mysql import MySQL


mysql = MySQL()
app = Flask(__name__)

# MySQL setup
app.config['MYSQL_DATABASE_USER'] = 'appuser'
app.config['MYSQL_DATABASE_PASSWORD'] = 'app9872#'
app.config['MYSQL_DATABASE_DB'] = 'appdb'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)


@app.route('/')
def main():
    return render_template('index.html')

@app.route('/showSignUp')
def showSignUp():
    return render_template('signup.html')


@app.route('/signUp',methods=['POST','GET'])
def signUp():
    try:
        _name = request.form['inputName']
Example #10
0
from flask import Flask, request, url_for, redirect, Response
from flask.ext.mysql import MySQL
import requests, json, random, string
from flask.ext.cors import CORS
from werkzeug.security import generate_password_hash, check_password_hash

app = Flask(__name__)
CORS(app, methods=['GET', 'PROPFIND', 'MKCOL', 'MOVE', 'COPY', 'HEAD', 'POST', 'OPTIONS', 'PUT', 'PATCH', 'DELETE'])
mysql=MySQL()
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'ismail'
app.config['MYSQL_DATABASE_PASSWORD'] = 'webdav'
app.config['MYSQL_DATABASE_DB'] = 'Webdav'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)


FILE = "sample.txt"
USERS = {
    "chikien": {
        "server":"apache2",
        "url":"http://localhost/webdav/",
        "permitted_files": [
            "/chikien/*",
            "/ismail/f1.jpeg"
        ]
    },
    "wael": {
        "server": "nginx",
        "url": "http://localhost:6002/",
import time
import signal
import sys
from flask import Flask, render_template
from flask.ext.mysql import MySQL
from flask.ext.socketio import SocketIO, emit
from queries import make_bookings, view_bookings, update_schedule

app = Flask('ColumbiaShuttleServices')
app.config['DEBUG'] = True
app.config['secret'] = 'css'
app.config['MYSQL_DATABASE_USER'] = 'psp2133'
app.config['MYSQL_DATABASE_PASSWORD'] = 'horcrux1'
app.config['MYSQL_DATABASE_DB'] = 'cs4111'
app.config['MYSQL_DATABASE_HOST'] = 'shuttle.cfs9lab4dyj4.us-west-2.rds.amazonaws.com'
app.config['MYSQL_DATABASE_PORT'] = 3306

socketio = SocketIO(app)
viewBookingsSession = None
makeBookingsSession = None
updateScheduleSession = None

mysql = MySQL()
mysql.init_app(app)
conn = mysql.connect()
cursor = conn.cursor()

class ViewBookings:
  qs = view_bookings()
  bookingid = None
Example #12
0
from decimal import Decimal
from alchemyapi import AlchemyAPI
import os
# from flask.ext.session import Session 

mysql = MySQL()
app = Flask(__name__)
cors = CORS(app)
alchemyapi = AlchemyAPI()
# sess = Session()

port = int(os.getenv('VCAP_APP_PORT', 5000))

app.secret_key = 'super secret key'

app.config['MYSQL_DATABASE_USER'] = 'b8acf770fad374'
app.config['MYSQL_DATABASE_PASSWORD'] = '0cd5ae1b'
app.config['MYSQL_DATABASE_DB'] = 'ad_5d17cac02297bd5'
app.config['MYSQL_DATABASE_HOST'] = 'us-cdbr-iron-east-02.cleardb.net'

mysql.init_app(app)

session = dict()

def log(msg):
	log_file = open('log.txt', 'a')
	log_file.write(msg + '\n')
	log_file.close()

@app.route('/logout', methods=['POST', 'OPTIONS'])
def logout():
Example #13
0
from functools import wraps
import hashlib
from flask_httpauth import HTTPDigestAuth
from bson import json_util
import json
from flask.json import JSONEncoder
from datetime import date, datetime, timedelta
import time
from dateutil.relativedelta import relativedelta
from api_tiprank import analysts



mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'Classify_Prod'
app.config['MYSQL_DATABASE_PASSWORD'] = 'f8WhcpDVMEv5LYEZ'
app.config['MYSQL_DATABASE_DB'] = 'Classify_Prod'
app.config['MYSQL_DATABASE_HOST'] = 'kibot-data.cgbzucciybhz.us-east-1.rds.amazonaws.com'


mysql.init_app(app)

cnx = mysql.connect()
cur = cnx.cursor()

api = Api(app)



Example #14
0
from flask import Flask, render_template, redirect, request, session
from flaskext.mysql import MySQL

mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'serverstudy'
app.config['MYSQL_DATABASE_PASSWORD'] = 'serverstudy!@#'
app.config['MYSQL_DATABASE_DB'] = 'serverstudy'
app.config['MYSQL_DATABASE_HOST'] = 'data.khuhacker.com'
app.config['MYSQL_CHARSET'] = 'utf-8'
app.secret_key ='safdsfasffaasaf'
mysql.init_app(app)
con = mysql.connect()
cur = con.cursor()
cur.execute("SELECT * FROM hu")
data = cur.fetchall()
@app.route('/', methods=['POST', 'GET'])
def basic():
    return render_template('index.html')

@app.route('/login')
def login():
    return render_template('login.html')

@app.route('/logincheck', methods=['POST'])
def check():
    inputID=request.form['id']
    inputPW=request.form['pw']

    if 'logged_in' in session.keys() and session['logged_in'] == True:
        return render_template('loginFile.html', message="You have already log-in")
import os , random
from flask import Flask, render_template, json, request,jsonify
from flask.ext.mysql import MySQL
import sys
app = Flask(__name__)
import time
from datetime import datetime as dt

today = time.strftime('%y-%m-%d')
print today
today = dt.strptime(today, "%y-%m-%d")

mysql = MySQL()
 
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'saurabh'
app.config['MYSQL_DATABASE_PASSWORD'] = 'saurabh'
app.config['MYSQL_DATABASE_DB'] = 'Flight_Management_System'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'

mysql.init_app(app)

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

def hasNumbers(inputString):
    return any(char.isdigit() for char in inputString)
def allNumbers(inputString):
    for i in inputString:
        if not i.isdigit():
            return False
Example #16
0
        config['db'] = "francescg$per_tests"
        config['logdir'] = "/home/francescg/tests_nauticos/logs/"

    else:
        config['host'] = "francescg.mysql.pythonanywhere-services.com"
        config['user'] = "francescg"
        config['passwd'] ="sapastre"
        config['db'] = "francescg$per_tests"
        config['logdir'] = "/home/francescg/tests_nauticos/logs/"

    return config

conf = config.get_config()
mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = conf['user']
app.config['MYSQL_DATABASE_PASSWORD'] = conf['passwd']
app.config['MYSQL_DATABASE_DB'] = conf['db']
app.config['MYSQL_DATABASE_HOST'] = conf['host']
mysql.init_app(app)
 
TOPIC_ID = 0

logging.basicConfig(filename = conf['logdir'] + 'server.log',level=logging.DEBUG)
logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(levelname)s %(message)s')

logging.debug("OK!")

@app.route('/')
def hello_world():
Example #17
0
from flask import Flask, jsonify, render_template, request, json
import MySQLdb

app = Flask(__name__)
app.debug = True
app.config['MYSQL_DATABASE_USER'] = 'potts'
app.config['MYSQL_DATABASE_PASSWORD'] = 'nicetry'
app.config['MYSQL_DATABASE_DB'] = 'potts$Potts'
app.config['MYSQL_DATABASE_HOST'] = 'potts.mysql.pythonanywhere-services.com'

class DB:
  conn = None

  def connect(self):
    self.conn = MySQLdb.connect(host="potts.mysql.pythonanywhere-services.com",
                                user="potts",
                                passwd="nicetry",
                                db="potts$Potts")

  def commit(self):
    self.conn.commit()

  def query(self, sql):
    try:
      cursor = self.conn.cursor()
      cursor.execute(sql)
    except (AttributeError, MySQLdb.OperationalError):
      self.connect()
      cursor = self.conn.cursor()
      cursor.execute(sql)
    return cursor.fetchall()
Example #18
0
import unicodedata, cgi
from flask import Flask, request, session, g, redirect, url_for, abort, \
     render_template, flash, abort
from flaskext.mysql import MySQL
from wtforms import Form, BooleanField, TextField, PasswordField, validators
from flask.ext.login import LoginManager, login_user, current_user,\
     logout_user, login_required, UserMixin

import MySQLdb

#import login.py
mysql = MySQL()
app = Flask(__name__)
app.config.from_object(__name__)

app.config['MYSQL_DATABASE_USER'] = 'Guest'
app.config['MYSQL_DATABASE_PASSWORD'] = 'guest@Password'
app.config['MYSQL_DATABASE_DB'] = 'my_recipes'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
mysql.init_app(app)

class LoginForm(Form):
    
    email = TextField('Email Address', [validators.Length(min=6, max=35)])
    password = PasswordField('Password', [
        validators.Required(),
    ])

# user class
class User(UserMixin):
Example #19
0
File: api.py Project: kluu006/CS180
from flask import Flask, jsonify
from flask_restful import Resource, Api, reqparse
from flask.ext.mysql import MySQL
import db_info # Database login information

app = Flask(__name__)
api = Api(app)

mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = db_info.db_user
app.config['MYSQL_DATABASE_PASSWORD'] =  db_info.db_pw
app.config['MYSQL_DATABASE_DB'] = db_info.db_name
app.config['MYSQL_DATABASE_HOST'] = db_info.db_host
app.config['MYSQL_USE_UNICODE'] = 'True'
mysql.init_app(app)

class CreateUser(Resource):
    def post(self):
        try:
            parser = reqparse.RequestParser()
            parser.add_argument('username', type=str, help='Gmail of user')
            args = parser.parse_args()

            _username = args['username']

            conn = mysql.connect()
            cursor = conn.cursor()
            cursor.callproc('createUser', args=[_username])
            data = cursor.fetchall()

            if len(data) is 0:
from flask import Flask, url_for, request, jsonify, make_response, g
from flask.ext.mysql import MySQL
from import_config import load_config
import json
import types

config = load_config()

mysql = MySQL()
basic_api = Flask(__name__)

basic_api.config['MYSQL_DATABASE_USER'] = config["database"]["user_name"]
basic_api.config['MYSQL_DATABASE_PASSWORD'] = config["database"]["password"]
basic_api.config['MYSQL_DATABASE_DB'] = config["database"]["db_instance"]
basic_api.config['MYSQL_DATABASE_HOST'] = config["database"]["connection_url"]

mysql.init_app(basic_api)

url_root = '/todo/api/v3.0/'

def format_json(element):
	new_task = {}
	new_task["id"] = element[0]
	new_task["title"] = element[1]
	new_task["description"] = element[2]
	new_task["done"] = element[3]
	return new_task

@basic_api.before_request
def db_connect():
	g.db_conn = mysql.connect()
Example #21
0
from flask import Flask, render_template, json, request
from flaskext.mysql import MySQL

mysql = MySQL()
app = Flask(__name__)

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'Kris110940'
app.config['MYSQL_DATABASE_PASSWORD'] = 'Kris110940'
app.config['MYSQL_DATABASE_DB'] = 'contactMe'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)


@app.route('/')
def main():
    return render_template('index.html')

@app.route('/showSignUp')
def showSignUp():
    return render_template('signup.html')


@app.route('/signUp',methods=['POST','GET'])
def signUp():
    try:
        _name = request.form['inputName']
        _email = request.form['inputEmail']
        _message = request.form['inputMessage']

        # validate the received values
Example #22
0
from flask import Flask, request, redirect
from twilio.rest import TwilioRestClient
from yahoo_finance import Share
from flask.ext.mysql import MySQL
from datetime import datetime
from creds import *
import json
import requests
import os
import twilio.twiml
import logging
logging.basicConfig(filename='/var/www/html/error.log',level=logging.DEBUG)
app = Flask(__name__)
mysql = MySQL()

app.config['MYSQL_DATABASE_USER'] = DB_USER
app.config['MYSQL_DATABASE_PASSWORD'] = DB_PASSWORD
app.config['MYSQL_DATABASE_DB'] = DB_NAME
app.config['MYSQL_DATABASE_HOST'] = DB_HOST
app.config['MYSQL_DATABASE_PORT'] = DB_PORT

mysql.init_app(app)
  
#this is the route that is setup at the twilio webhook
#it splits up the body of the sms and calls the appropriate function
@app.route('/messageHandler',methods=['POST'])
def messageHandler():
    #grab the number the incoming sms in coming from
    from_number = request.values.get('From', None)
    #grab the body of incoming sms, convert to upper case 
    #and split the string into a list words
Example #23
0
from routes.coordinador_routes import coordinador
from routes.estudiante_routes import estudiante
from routes.jurado_routes import jurado
from routes.login_routes import login_r
from routes.secretaria_routes import secretaria
from routes.usuario_routes import usuario

tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'views')
app = Flask(__name__, template_folder=tmpl_dir)
app.secret_key = 'proyecto_ufps'
mysql = MySQL()

# import routes
app.register_blueprint(login_r)
app.register_blueprint(usuario, url_prefix="/usuarios")
app.register_blueprint(jurado, url_prefix="/jurado")
app.register_blueprint(secretaria, url_prefix="/secretaria")
app.register_blueprint(coordinador, url_prefix="/coordinador")
app.register_blueprint(estudiante, url_prefix="/estudiante")

# MySQL configurations

app.config['MYSQL_DATABASE_USER'] = 'ufps_35'
app.config['MYSQL_DATABASE_PASSWORD'] = 'ufps_11'
app.config['MYSQL_DATABASE_DB'] = 'ufps_35'
app.config['MYSQL_DATABASE_HOST'] = 'sandbox2.ufps.edu.co'
mysql.init_app(app)

if __name__ == "__main__":
    app.run(debug=True)
Example #24
0
#sys.path.append("/home/seb/Fridge_Project/Requetes_web/")
import reqTest
import datetime

#import Partie detection code
sys.path.append("/home/seb/Fridge_Project/Bar_code_Detection/")
import detect_CB
import numpy as np
import cv2
import detect_CB
from time import sleep


mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'seb1'
app.config['MYSQL_DATABASE_PASSWORD'] = 'azop'
app.config['MYSQL_DATABASE_DB'] = 'bddproject'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)  


     
@app.route("/")
def hello():
	return "It's working !!!!!!!!!!!!!!!!!!!!!!!!!!!"
    
@app.route("/addelem/")
def detecte():

	i=0
Example #25
0
from flask import Flask, render_template, json, request
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash

mysql = MySQL()
app = Flask(__name__)

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'jay'
app.config['MYSQL_DATABASE_PASSWORD'] = 'jay'
app.config['MYSQL_DATABASE_DB'] = 'BucketList'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)


@app.route('/')
def main():
    return render_template('index.html')

@app.route('/showSignUp')
def showSignUp():
    return render_template('signup.html')


@app.route('/signUp',methods=['POST','GET'])
def signUp():
    try:
        _name = request.form['inputName']
        _email = request.form['inputEmail']
        _password = request.form['inputPassword']
Example #26
0
from werkzeug import generate_password_hash, check_password_hash

# from pprint import pprint

# App Configurations
app = Flask(__name__)

# Load config file for DB user info
with open('config.json') as data_file: 
    config = json.load(data_file)

# Set secret key to use the session module
app.secret_key = config["secret_key"]

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = config["username"]
app.config['MYSQL_DATABASE_PASSWORD'] = config["password"]
app.config['MYSQL_DATABASE_DB'] = 'BucketList'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'

mysql = MySQL()
mysql.init_app(app)

# Routing Definitions
@app.route("/")
def main():
	return render_template("index.html")

@app.route('/showSignUp')
def showSignUp():
    return render_template('signup.html')
Example #27
0
from dotenv import load_dotenv
from os.path import join, dirname

import os

# from flask.ext.compress import Compress

app = Flask(__name__)

# dotenv shit
dotenv_path = join(dirname(dirname(__file__)), '.env')
load_dotenv(dotenv_path)

# db setup shit 
app.mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = os.environ.get('DB_USER')
app.config['MYSQL_DATABASE_PASSWORD'] = os.environ.get('DB_PASS')
app.config['MYSQL_DATABASE_DB'] = os.environ.get('DB_NAME')
app.config['MYSQL_DATABASE_HOST'] = os.environ.get('DB_HOST')
app.mysql.init_app(app)

# compress = Compress()
# 
# def start_app():
#     app = Flask(__name__)
#     compress.init_app(app)
#     return app
# 
# app = start_app()

# from web import views
Example #28
0
from flask import Flask, render_template, request, redirect, url_for, abort, session
from flaskext.mysql import MySQL
import json
from datetime import date, timedelta, datetime
import time
import datetime

app = Flask(__name__)
mysql = MySQL()

app.config['MYSQL_DATABASE_USER'] = 'opinio'
app.config['MYSQL_DATABASE_PASSWORD'] = "Opinio@123"
app.config['MYSQL_DATABASE_DB'] = 'opinio_db'
app.config['MYSQL_DATABASE_HOST'] = '172.31.99.109'
mysql.init_app(app)


@app.route('/discount', methods=['POST', 'GET'])
def render_discount():
	print "render_discount"
	conn = mysql.get_db()
	cur = conn.cursor()
        
	try:
		print "querying"
		query = "select * from coupon;"
		cur.execute(query)
		data = cur.fetchall()
                data_list = []
		print type(data)
		for row in data:
Example #29
0
from functools import wraps
from flask import Flask, session, redirect, url_for, escape, request, Response


#dev
from response_controller import *
from user import *
from switchs import *


app = Flask(__name__)


app.config['MYSQL_DATABASE_USER'] = 'domuspi'
app.config['MYSQL_DATABASE_PASSWORD'] = 'domuspi'
app.config['MYSQL_DATABASE_DB'] = 'domuspi'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'


# db = Db(app)

def islogged():
  return session['login'] == True

def requires_auth(f):
  @wraps(f)
  def decorated(*args, **kwargs):
    if not islogged():
      return Response('Access Denied', 401)
    return f(*args, **kwargs)
  return decorated
Example #30
0
from flask import Flask, render_template, json, request,redirect,session,jsonify, url_for
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash
from werkzeug.wsgi import LimitedStream
import uuid
import os

mysql = MySQL()
app = Flask(__name__)
app.secret_key = 'why would I tell you my secret key?'

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'vquinn'
app.config['MYSQL_DATABASE_PASSWORD'] = 'password'
app.config['MYSQL_DATABASE_DB'] = 'BucketList'
app.config['MYSQL_DATABASE_HOST'] = 'vquinn-flask.cdhmfmzalg3v.us-west-2.rds.amazonaws.com'
mysql.init_app(app)

# Default setting
pageLimit = 5

class StreamConsumingMiddleware(object):

    def __init__(self, app):
        self.app = app

    def __call__(self, environ, start_response):
        stream = LimitedStream(environ['wsgi.input'],
                               int(environ['CONTENT_LENGTH'] or 0))
        environ['wsgi.input'] = stream
        app_iter = self.app(environ, start_response)