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
Example #5
0
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
    body = request.values.get('Body')
    body = body.strip().upper()
    bodyList = body.split()
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 #7
0
url = urlparse.urlparse('mysql://admin7YSeANi:ShMwe1xM2sV4@127.12.232.130:3306')

user = url.username,
pass1 = url.password,
host= url.hostname,
port = url.port
        

app.config['MYSQL_DATABASE_PORT'] = 3306
#host1=os.getenv('OPENSHIFT_MYSQL_DB_HOST')
app.config['MYSQL_DATABASE_USER'] = 'admin7YSeANi'
app.config['MYSQL_DATABASE_PASSWORD'] = 'ShMwe1xM2sV4'
app.config['MYSQL_DATABASE_DB'] = 'projectdb_schema'

#app.config['MYSQL_DATABASE_HOST'] = 'ex-std-node455.prod.rhcloud.com'
app.config['MYSQL_DATABASE_HOST'] = '127.12.232.130'


mysql.init_app(app)
#mainpage
@app.route('/')
def main():
    return render_template('index.html')
#mainpage duplicate
@app.route('/home')
def home():
    return render_template('index.html')


#signuppage
@app.route('/showSignUp')
Example #8
0
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

# setup blueprints for each page
from web.home.views import home
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
from flask import Flask, render_template, redirect, url_for, escape, request
from flask.ext.socketio import SocketIO, emit
from flaskext.mysql import MySQL
import json
from random import choice
from time import time

mysql = MySQL()
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
app.config['MYSQL_DATABASE_USER'] = 'USER_NAME'
app.config['MYSQL_DATABASE_PASSWORD'] = 'PASSWORD'
app.config['MYSQL_DATABASE_DB'] = 'DB_NAME'
app.config['MYSQL_DATABASE_HOST'] = '127.0.0.1'
app.debug = True
socketio = SocketIO(app)
mysql.init_app(app)

current_path = ""
animals = json.load(open('data/animals.json','r'))
adjs = json.load(open('data/adjectives.json','r'))
animal = {}

for a in animals:
	if a[0] not in animal:
		animal[a[0]] = []
	animal[a[0]].append(a)
	

@socketio.on('my event', namespace='/test')
def test_message(message):
Example #11
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 #12
0
from config import MYSQL_INFO

from sparkquery import sparkQuery
from mysqlquery import mysqlQuery

import MySQLdb as mysql

import threading
import json

# init flask app
app = Flask(__name__)
app.config.from_object(__name__)

app.config['MYSQL_DATABASE_HOST'] = MYSQL_INFO['host']
app.config['MYSQL_DATABASE_DB'] = MYSQL_INFO['db']
app.config['MYSQL_DATABASE_USER'] = MYSQL_INFO['user']
app.config['MYSQL_DATABASE_PASSWORD'] = MYSQL_INFO['passwd']


def general_query(source='hive', timestart=0, timeend=0, tp=0, pt1=(0,0), pt2=(0,0), mmsi=[0], output='csv'):
	'''general query function
		Args:
			source: 	data source, include 'hive', 'mysql', 'oracle'
			timestart:	start time of query range
			timeend:	end time of query range
			type:		space query type, 
						0: pt1 is upper left (lo,la) coordinate, pt2 is (vertical, horizontal) length
						1: pt1 is upper left (lo,la) coordinate, pt2 is lower right (lo,la) coordinate
						2: pt1 is the centor of the circle and pt2 is (R,0) where R is the redius
Example #13
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)
Example #14
0

from metamind.api import set_api_key, food_image_classifier
import urllib2
import os
import json
import time 

set_api_key('R71f8xzpv9EHlNH1HZbYfKFWks80ceLTQOPMoynY0mV3KR7Q0j')
app = Flask(__name__)
CORS(app)
mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = 'websysS16GB4'
app.config['MYSQL_DATABASE_PASSWORD'] = 'websysS16GB4!!'
app.config['MYSQL_DATABASE_DB'] = 'websysS16GB4'
app.config['MYSQL_DATABASE_HOST'] = 'websys3.stern.nyu.edu'
mysql.init_app(app)



''''''''''''''''''''''''''''''''''''''
'''        Login  Check            '''
''''''''''''''''''''''''''''''''''''''
@app.route("/login/" , methods=["POST"])
@cross_origin(origin='*',headers=['Content-Type','Authorization'])
def login():
   data = {}
   
   db = mysql.connect()

   cur = db.cursor()
Example #15
0
from flask import Flask
from flask_restful import Resource, Api
from flask_restful import reqparse
from flask.ext.mysql import MySQL
import os



mysql = MySQL()
app = Flask(__name__)

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = os.environ["MYSQL_USER"]
app.config['MYSQL_DATABASE_PASSWORD'] = os.environ["MYSQL_PASSWORD"]
app.config['MYSQL_DATABASE_DB'] = 'ItemListDb'
app.config['MYSQL_DATABASE_HOST'] = os.environ["MYSQL_URL"]
app.config['MYSQL_DATABASE_PORT']=3306


mysql.init_app(app)

api = Api(app)

class AuthenticateUser(Resource):
    def post(self):
        try:
            # Parse the arguments

            parser = reqparse.RequestParser()
            parser.add_argument('email', type=str, help='Email address for Authentication')
            parser.add_argument('password', type=str, help='Password for Authentication')
Example #16
0
import logging
logging.basicConfig(filename='logs/illumi_db.log',level=logging.INFO)

from flask import Flask
from flask.ext.mysql import MySQL
import config
import datetime
import MySQLdb
app = Flask(__name__)
mysql = MySQL()

# Retrieve the connection settings from the config.py file..
app.config['MYSQL_DATABASE_USER'] = config.my_username
app.config['MYSQL_DATABASE_PASSWORD'] = config.my_password
app.config['MYSQL_DATABASE_DB'] = config.my_db
app.config['MYSQL_DATABASE_HOST'] = config.my_host

mysql.init_app(app)
conn = mysql.connect()
conn.autocommit(True)

cursor = conn.cursor()
print "[DB] " + "---Successfully connected to DB---"
logging.info("\n")
logging.info("[DB] " + "\t\t---Successfully connected to DB---\t\t [DB]")
logging.info("\n")
logging.info("\n")


# Signing up to the main database BucketList..
def signup_to_database(username, email, password):
Example #17
0
from flask import Flask, render_template, json, request, redirect, session
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash
import uuid, os

app = Flask(__name__)

mysql = MySQL()

# MySQL configurations
docker_host = 'mysql'
localhost  = '127.0.0.1'
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'sql'
app.config['MYSQL_DATABASE_DB'] = 'BucketList'
app.config['MYSQL_DATABASE_HOST'] = docker_host
mysql.init_app(app)
app.secret_key = 'thiskeyissosecret'
pageLimit = 5
app.config['UPLOAD_FOLDER'] = 'static/Uploads'

@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():
Example #18
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 #19
0
from random import randint
from socket import *



#WSGI APP
app = Flask(__name__)

#APP CONFIGURATIONS, WILL MOVE THIS TO IT'S OWN FILE
cache = Cache(app, config={'CACHE_TYPE': 'redis'})

#MYSQL CONFIG
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = ''
app.config['MYSQL_DATABASE_DB'] = 'AppDynamics'
app.config['MYSQL_DATABASE_HOST'] = 'pythondemo-mysql'

#REDIS CONFIG
app.config['REDIS_QUEUE_KEY'] = 'AppDynamicsQueue'
app.config['REDIS_HOST'] = 'pythondemo-redis'
app.config['REDIS_PORT'] = 6379
app.config['REDIS_DB'] = 0

#MYSQL CONNECTION
mysql = MySQL()
mysql.init_app(app)


#ELASTICSEARCH CONNECTION
es = Elasticsearch([
	{'host': 'pythondemo-elasticsearch'},
Example #20
0
from flask_socketio import SocketIO
from flaskext.mysql import MySQL

#for test
from Person import Person

#from werkzeug import generate_password_hash, check_password_hash

mysql = MySQL()
app = Flask(__name__)

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'admin'
app.config['MYSQL_DATABASE_DB'] = 'python'
app.config['MYSQL_DATABASE_HOST'] = '0.0.0.0'

app.config['SECRET_KEY'] = 'secret!'

mysql.init_app(app)
io = SocketIO(app)


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

@app.route('/showSignUp')
def showSignUp():
    return render_template('signup.html')
Example #21
0
    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():
    return 'Hello from Flask!'

@app.route('/a/edit_question', methods=['GET','POST'])
from flask import Flask, render_template, request, redirect
from flaskext.mysql import MySQL

app = Flask(__name__)

mysql = MySQL()
 
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'my-secret-pw'
app.config['MYSQL_DATABASE_DB'] = 'sydney'
app.config['MYSQL_DATABASE_HOST'] = 'mysql'
mysql.init_app(app)



@app.route('/', methods=['GET'])
def list_messages():
    messages = []
    try:
        conn = mysql.connect()
        cursor = conn.cursor()
        cursor.execute("SELECT * from sydney.messages")
        rows = cursor.fetchall()
        for id,value in rows:
            messages.append(value)
        return render_template('index.html', messages=messages)

    except Exception as e:
        raise e
    finally:
Example #23
0
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")
def Logout():
	session.pop('username', None)
	return render_template('/login/login.html',title="ENABLE INDIA - LOGIN")
Example #24
0
#-*- encoding: utf-8 -*-
from flask import Flask, render_template
from flaskext.mysql import MySQL
import requests, time
import threading, json
from RoadInfoClass import RoadInfo

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

#declare RoadInfo instance
roadRecord = RoadInfo()

def InserttoDB():
    global roadRecord
    while True:
        url = 'http://data.ex.co.kr/openapi/safeDriving/forecast?key=####&type=json'

        #request from url
        response = requests.get(url)

        #extract HTML from response
        json_content = response.text.encode('utf-8')
        json_dict = json.loads(json_content)
        roadRecord.setRecord(json_dict['list'][0]['sdate'], json_dict['list'][0]['cjibangDir'], json_dict['list'][0]['cseoulDir'],
Example #25
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:
Example #26
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")
Example #27
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 #28
0
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)




# -------------------------------------------Authentication---------------------------------------------------------

def calculate_hash(api_key):
Example #29
0
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.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():
	info = dict()
	session.clear()