Beispiel #1
0
    def conexion(self):
        mysql = MySQL()
        control = Flask(__name__)

        control.config["MYSQL_DATABASE_USER"] = "wtec"
        control.config["MYSQL_DATABASE_PASSWORD"] = "wtec.s"
        control.config["MYSQL_DATABASE_DB"] = "wtec_webapp"
        control.config["MYSQL_DATABASE_HOST"] = "192.168.227.1"
        mysql.init_app(control)
        return mysql
Beispiel #2
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!"
Beispiel #3
0

""" @app.route("/profile/<username>")
def show_user_profile(username):
    return "User: " + str(username)

@app.route("/post/<int:post_id>")
def show_user_post(post_id):
    return "Post: " + str(post_id)

@app.route("/")
def show_url_for():
    return url_for('show_user_profile', username = 'arif') """

if __name__ == "__main__":
    app.secret_key = "SuperSecretKey"
    app.debug = True

    # mysql
    mysql = MySQL()
    app.config["MYSQL_DATABASE_USER"] = "root"
    app.config["MYSQL_DATABASE_PASSWORD"] = "test"
    app.config["MYSQL_DATABASE_DB"] = "my_flask_app"
    app.config["MYSQL_DATABASE_HOST"] = "mqsql"
    mysql.init_app(app)

    # logging
    handler = RotatingFileHandler("error.log", maxBytes=10000, backupCount=1)
    handler.setLevel(logging.INFO)
    app.logger.addHandler(handler)
    app.run(host="0.0.0.0")
Beispiel #4
0
from json import dumps
from base64 import b64encode
from datetime import datetime, timedelta
from hashlib import sha1
import time, os, json, base64, hmac, urllib


global app, mysql, mail, baseS3Url

app = Flask(__name__)

mysql = MySQL()
baseS3Url = "https://filshack.s3.amazonaws.com/"

app.config["MYSQL_DATABASE_USER"] = "b0c31b0e5f6108"
app.config["MYSQL_DATABASE_PASSWORD"] = "a28c9ca5243937f"
app.config["MYSQL_DATABASE_HOST"] = "us-cdbr-iron-east-03.cleardb.net"
app.config["MYSQL_DATABASE_DB"] = "heroku_d4e136b9b4dc6f5"
app.config["AWS_S3_BUCKET"] = "filmshack"
app.config["AWS_ACCESS_KEY_ID"] = "AKIAJMYLTY2I4EHYNUVA"
app.config["AWS_SECRET_ACCESS_KEY"] = "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"
app.config["SECRET_KEY"] = "SET T0 4NY SECRET KEY L1KE RAND0M H4SH"

"""
url = urlparse.urlparse(os.environ['DATABASE_URL'])
app.config['MYSQL_DATABASE_USER'] = url.username
app.config['MYSQL_DATABASE_PASSWORD'] = url.password
app.config['MYSQL_DATABASE_HOST'] = url.hostname
app.config['MYSQL_DATABASE_DB'] = "heroku_d4e136b9b4dc6f5"
app.config['SECRET_KEY'] = 'SET T0 4NY SECRET KEY L1KE RAND0M H4SH'
"""
Beispiel #5
0
# 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")
Beispiel #6
0
from apiclient import discovery
import datetime

CLIENT_ID = "456555048105-49j7n97kvjuluk4f0b3598m70sk0e293"
SCOPE = "https://www.googleapis.com/auth/calendar"
CLIENT_SECRET_FILE = "client_secret.json"
APPLICATION_NAME = "SmartShower"

app = Flask(__name__)
mysql = MySQL()

app.secret_key = "super secret key"
app.config["SESSION_TYPE"] = "filesystem"

app.config["MYSQL_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "root"
app.config["MYSQL_DATABASE_DB"] = "SmartShowerDB"
app.config["MYSQL_DATABASE_HOST"] = "localhost"

mysql.init_app(app)

##################################################################


def get_long(new_start, new_end, scheduled_start, scheduled_end):
    if scheduled_end - new_start > new_end - scheduled_start:
        return 0
    else:
        return 1

Beispiel #7
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()
Beispiel #8
0
from flask import Flask, render_template, request, json
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash

app = Flask(__name__)

mysql = MySQL()
# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "powerc"
app.config["MYSQL_DATABASE_DB"] = "BucketList"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)

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


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


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


@app.route("/signUp", methods=["POST"])
def signUp():
    _name = request.form["inputName"]
Beispiel #9
0
from flask import Flask, json, request
import collections
from flask.ext.mysql import MySQL

mysql = MySQL()
app = Flask(__name__)
cuenta = 0


# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "VFhcs123!"
app.config["MYSQL_DATABASE_DB"] = "fruit"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)


@app.route("/")
def hello():
    global cuenta
    cuenta = cuenta + 1
    return "<h1 style='color:blue'>Hello There! v.012 c:" + str(cuenta) + "</h1>"


@app.route("/q1", methods=["POST", "GET"])
def signUp():
    try:
        # _name = request.form['inputName']
        # _email = request.form['inputEmail']
        # _password = request.form['inputPassword']
Beispiel #10
0
from flask import Flask, render_template, request, url_for, flash, session, redirect  # NEW IMPORT -- request
from flask.ext.wtf import Form
from wtforms import TextField, TextAreaField, SubmitField, PasswordField
from forms import ContactForm, GeturlForm, ChangeForm  # NEW IMPORT LINE
from flaskext.mysql import MySQL
from flask.ext.login import login_user, login_required, logout_user, LoginManager
from functools import wraps

mysql = MySQL()
app = Flask(__name__)
app.secret_key = "WebDesign"
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "223119"
app.config["MYSQL_DATABASE_DB"] = "EmpData"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)

login_manager = LoginManager()
login_manager.init_app(app)
# login_manager.login_view = "user.login"

UPLOAD_FOLDER = "/Home/Github/Teamproject/static"
ALLOWED_EXTENSIONS = set(["txt", "pdf", "png", "jpg", "jpeg", "gif"])
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER

# decorator that links...
@app.route("/")  # This is the main URL
def default():
    return render_template("index.html", name="index", title="HOME PAGE")  # The argument should be in templates folder

Beispiel #11
0
from flask import Flask, render_template, request, json
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"] = "felix"
app.config["MYSQL_DATABASE_PASSWORD"] = "felix"
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"])
def signUp():

    try:

        # read the posted values from the UI
import code  # to debug: `code.interact(local=locals())` or `code.interact(local=dict(globals(), **locals()))`
import os
from flask import Flask  # , render_template, request, session, g, redirect, url_for, abort, flash
from flaskext.mysql import MySQL  # https://github.com/cyberdelia/flask-mysql

try:
    DB_ROOT_PASSWORD = os.environ[
        "MYSQL_ROOT_PASSWORD"
    ]  # if your root user has a password, assign it to the "MYSQL_ROOT_PASSWORD" environment variable
except KeyError as e:
    DB_ROOT_PASSWORD = ""  # most students' root user doesn't have a password

app = Flask(__name__)
app.secret_key = os.urandom(24)  # to facilitate sessions and flash
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = DB_ROOT_PASSWORD
app.config["MYSQL_DATABASE_DB"] = "salad_db"
app.config["MYSQL_DATABASE_HOST"] = "localhost"

mysql = MySQL()
mysql.init_app(app)


def create_menu_item():
    connection = mysql.connect()
    cursor = connection.cursor()
    sql = "INSERT INTO `menu_items` (`category`,`title`,`calories`,`gluten_free`,`vegan_safe`,`description`) VALUES (%s, %s, %s, %s, %s, %s)"
    print(sql)
    cursor.execute(
        sql, ("SignatureSalad", "TEST SALAD", 1111, 0, 1, "a salad to use when testing the web application.")
    )
Beispiel #13
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"]
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
from flask import request, redirect, url_for, render_template, send_from_directory, session
from flask.ext.mysql import MySQL
from werkzeug import secure_filename
from mimetypes import MimeTypes
import os
import time
import logging
import boto3
from boto3.s3.transfer import S3Transfer
from config import *

image_uploader = Flask(__name__)
mysql = MySQL()
image_uploader.config["MYSQL_DATABASE_USER"] = DB_USER
image_uploader.config["MYSQL_DATABASE_PASSWORD"] = DB_PASS
image_uploader.config["MYSQL_DATABASE_DB"] = DB_NAME
image_uploader.config["MYSQL_DATABASE_HOST"] = DB_HOST
mysql.init_app(image_uploader)

#
# Help functions
#
def allowed(filename):
    return "." in filename and filename.rsplit(".", 1)[1] in IMAGE_TYPES


def put_s3_objetct(image_name, storage_dir):
    mime = MimeTypes()
    s3 = boto3.client("s3", region_name=AWS_REGION)
    transfer = S3Transfer(s3)
Beispiel #16
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")
Beispiel #17
0
from flask import Flask, render_template, json, request, redirect, session, jsonify, flash
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash
import os

mysql = MySQL()
app = Flask(__name__)
app.secret_key = "vingardium leviosa"

app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "golchacr7"
app.config["MYSQL_DATABASE_DB"] = "lrlr"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)

# Home Page Route
# If found a session, then re-direct to userHome
@app.route("/")
def home():
    if session.get("user"):
        return render_template("userHome.html")
    else:
        return render_template("landing_mat.html")


# Connecting the Signup with the database to handle the requests
@app.route("/signup", methods=["POST"])
def signup():
    try:
        _name = request.form["username_reg"]
        _email = request.form["email_reg"]
Beispiel #18
0
# -*- coding:utf-8 -*-
from flask import Flask, render_template, request
from flask_bootstrap3 import Bootstrap
from flaskext.mysql import MySQL
import recom
from models import GoodsTable, SimUserTable

app = Flask(__name__)
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "34092402"
app.config["MYSQL_DATABASE_DB"] = "ad_recom"
app.config["MYSQL_DATABASE_CHARSET"] = "gb2312"
mysql = MySQL(app)


# 路由函数
@app.route("/")
def index():
    user_id = request.args.get("user_id")  # 获取get参数中的user_id
    if user_id != "" and user_id is not None:  # 判空
        cursor = mysql.connect().cursor()

        user_name = recom.find_user_name(cursor, user_id)
        items = recom.simple_recom(cursor, user_id)
        if len(items) > 0:
            goods_table = GoodsTable(items, classes=["goodsTable", "table"])

            usersItem = recom.find_similar_users(cursor, user_id)
            sim_user_table = SimUserTable(usersItem, classes=["simiUserTable", "table"])
            return render_template(
                "index.html",
Beispiel #19
0
#!/usr/bin/python
from flask import Flask, render_template, request, flash, Session, url_for, redirect
from flaskext.mysql import MySQL
from flask.ext.login import LoginManager, UserMixin, login_required, login_user, logout_user, current_user
import os

mysql = MySQL()
app = Flask(__name__)
app.config["MYSQL_DATABASE_USER"] = "admin"
app.config["MYSQL_DATABASE_PASSWORD"] = "admin"
app.config["MYSQL_DATABASE_DB"] = "ProjetSGBD"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)

app.config["SECRET_KEY"] = "secret"
app.config["IMAGE_FOLDER"] = "static/images/recettes"

login_manager = LoginManager()
login_manager.init_app(app)


class User(UserMixin):
    """docstring for User"""

    def __init__(self, login, id, active=True):
        self.login = login
        self.id = id
        self.active = active

        cursor = mysql.connect().cursor()
        query = "SELECT * FROM Eleve WHERE Id_eleve = " + str(id)
Beispiel #20
0

app = Flask(__name__)
mysql = MySQL()

app.config["MYSQL_DATABASE_HOST"] = (
    os.environ["MYSQL_DATABASE_HOST"] if "MYSQL_DATABASE_HOST" in os.environ else config.MYSQL_DATABASE_HOST
)
app.config["MYSQL_DATABASE_PORT"] = (
    os.environ["MYSQL_DATABASE_PORT"] if "MYSQL_DATABASE_PORT" in os.environ else config.MYSQL_DATABASE_PORT
)
app.config["MYSQL_DATABASE_USER"] = (
    os.environ["MYSQL_DATABASE_USER"] if "MYSQL_DATABASE_USER" in os.environ else config.MYSQL_DATABASE_USER
)
app.config["MYSQL_DATABASE_PASSWORD"] = (
    os.environ["MYSQL_DATABASE_PASSWORD"] if "MYSQL_DATABASE_PASSWORD" in os.environ else config.MYSQL_DATABASE_PASSWORD
)
app.config["MYSQL_DATABASE_DB"] = (
    os.environ["MYSQL_DATABASE_DB"] if "MYSQL_DATABASE_DB" in os.environ else config.MYSQL_DATABASE_DB
)

mysql.init_app(app)

if "SECRET_KEY" in os.environ:
    app.config["SECRET_KEY"] = os.environ["SECRET_KEY"]
else:
    app.config["SECRET_KEY"] = os.urandom(24)


def connect_db():
    return mysql.connect()
Beispiel #21
0
from flask import Flask, jsonify
from flaskext.mysql import MySQL
from user import user_api
from forum import forum_api
from threaad import thread_api
from post import post_api

mysql = MySQL()

app = Flask(__name__)

app.config["MYSQL_DATABASE_USER"] = "dev"
app.config["MYSQL_DATABASE_PASSWORD"] = "12345678"
app.config["MYSQL_DATABASE_DB"] = "db_project"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False

app.register_blueprint(user_api, url_prefix="/db/api/user/")
app.register_blueprint(forum_api, url_prefix="/db/api/forum/")
app.register_blueprint(thread_api, url_prefix="/db/api/thread/")
app.register_blueprint(post_api, url_prefix="/db/api/post/")

mysql.init_app(app)


@app.route("/", methods=["GET"])
def hello():
    conn = mysql.get_db()
    cursor = conn.cursor()
    cursor.execute("SELECT @@FOREIGN_KEY_CHECKS")
    return jsonify(code=0, response=cursor.fetchall()[0][0])
Beispiel #22
0
from flask import Flask, json
from flaskext.mysql import MySQL

app = Flask(__name__)
"""
mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = 'adminaNexbHw'
app.config['MYSQL_DATABASE_PASSWORD'] = 'payGAaEUSTkA'
app.config['MYSQL_DATABASE_DB'] = 'AESMI'
app.config['MYSQL_DATABASE_HOST'] = '127.4.124.130'
mysql.init_app(app)
"""

mysql = MySQL()
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "lion"
app.config["MYSQL_DATABASE_DB"] = "AESMI"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)


def acessa_proc(nome, sql):
    try:
        conn = mysql.connect()
        cursor = conn.cursor()
        cursor.callproc(nome, sql)
        data = cursor.fetchall()
        if len(data) is 0:
            conn.commit()
        else:
            return data
Beispiel #23
0
from flask import Flask, Response, request, make_response, render_template, redirect, url_for
from flaskext.mysql import MySQL
from random import randint


mysql = MySQL()
app = Flask(__name__)
app.config["MYSQL_DATABASE_USER"] = "msp"
app.config["MYSQL_DATABASE_PASSWORD"] = "monkey2"
app.config["MYSQL_DATABASE_DB"] = "msp"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)

SESSION_INTERVAL = 15


def auth_user(username, password):
    cur = mysql.connect().cursor()
    cur.execute(
        "SELECT id,ext_id,username,name FROM msp.user where username='%s' and password='%s'" % (username, password)
    )
    if cur.rowcount == 1:
        rv = cur.fetchone()
        return rv[1]
    else:
        return False


def check_session():
    if "msp_session" in request.cookies:
        cur = mysql.connect().cursor()
Beispiel #24
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 = MySQL()

# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "510613"
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("/signUp", methods=["POST", "GET"])
def signUp():
    if request.method == "POST":
        _name = request.form["user"]
        _email = request.form["email"]
        _password = request.form["pwd"]
Beispiel #25
0
from flask import Flask, render_template, json, request, session, redirect, jsonify, url_for
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash
from werkzeug.wsgi import LimitedStream
import os, uuid

mysql = MySQL()
app = Flask(__name__)

# secret key
app.secret_key = "why would I tell you my secret key?"

# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "password"
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("/userHome")
def userHome():
    if session.get("user"):
        return render_template("userHome.html")
    else:
        return render_template("error.html", error="Unauthorized Access")
from flask import Flask, render_template, request, json
from flask.ext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash

app = Flask(__name__)

mysql = MySQL()

# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "sliotars59"
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"])
def signUp():
    try:
        # read the posted values from the UI
        _name = request.form["inputName"]
# all the imports
from contextlib import closing
from flaskext.mysql import MySQL
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash

# configuration
mysql = MySQL()
app = Flask(__name__, static_url_path="/home/sathaye/COEN280/Amazon/static", static_folder="images")
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "sathaye"
app.config["MYSQL_DATABASE_DB"] = "COEN280"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
app.config["MYSQL_DATABASE_PORT"] = 3306
mysql.init_app(app)
app.config.from_object(__name__)

con = mysql.connect()
cursor = con.cursor()
Beispiel #28
0
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
			pt1:		(lo,la) point
			pt2:		see 'type'
			mmsi:		-1: all mmsi
Beispiel #29
0
from flask.ext.mysql import MySQL
from flask.ext.triangle import Triangle
from werkzeug import generate_password_hash, check_password_hash
from werkzeug.wsgi import LimitedStream
import collections
import uuid
import os

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

# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "badag"
app.config["MYSQL_DATABASE_DB"] = "BucketList"
app.config["MYSQL_DATABASE_HOST"] = "localhost"
mysql.init_app(app)

# Default setting
pageLimit = 3


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
Beispiel #30
0
from flaskext.mysql import MySQL
from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime, date, time, timedelta
import config


app = Flask(__name__)
app.config["DEBUG"] = True
app.config["PROPAGATE_EXCEPTIONS"] = True


mysql = MySQL()

# MySQL configurations
app.config["MYSQL_DATABASE_USER"] = config.DB_USER
app.config["MYSQL_DATABASE_PASSWORD"] = config.DB_PW
app.config["MYSQL_DATABASE_DB"] = config.DB_SCHEMA
app.config["MYSQL_DATABASE_HOST"] = config.DB_HOST
mysql.init_app(app)

app.secret_key = "I miss the comfort in being sad."


@app.route("/")
def main():
    if session.get("user"):
        return redirect("/userHome")
    else:
        return render_template("index.html")