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
# -*- 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 #6
0
app = Flask(__name__)

nodes = {1:"http://172.24.65.29:5000",2:"http://10.211.55.4:5000",3:"http://10.211.55.3:5000"}

nodeID = 3
NodeKey = 'node3pass'

# Sessions variables are stored client side, on the users browser the content of the variables is encrypted, so users can't
# actually see it. They could edit it, but again, as the content wouldn't be signed with this hash key, it wouldn't be valid
# You need to set a secret key (random text) and keep it secret
app.config['SECRET_KEY']='DBMSProject'

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

class SignupForm(Form):
	name = StringField('What is your Name?',validators=[Required()])
	password = PasswordField('Select a Password',validators=[Required()])
	signup = SubmitField('Sign Up')

class LoginForm(Form):
	walletID = StringField('Enter your Wallet ID', validators=[Required()])
	password = PasswordField('Enter your Password', validators=[Required()])
	submit = SubmitField("Login")

class WalletForm(Form):
	receiverID = StringField("Enter Receiver's Wallet ID", validators=[Required()])
Example #7
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
Example #8
0
from flask import Flask, request, send_file;
from flaskext.mysql import MySQL;
import json;
import os;

UPLOAD_FOLDER = "/User/Taejun/Documents/nexta/image"

app = Flask(__name__);
mysql = MySQL();

app.config['MYSQL_DATABASE_USER'] = 'root';
app.config['MYSQL_DATABASE_PASSWORD'] = '1234';
app.config['MYSQL_DATABASE_DB'] = 'nextagram';

mysql.init_app(app);

@app.route("/")
def helloWrold():
	return "helloWrold";

@app.route("/loadData", methods = ["GET", "POST"])
def loadData():

	cursor = mysql.connect().cursor();
	cursor.execute("select * from next_android_nextagram")

	result = []
	columns = tuple( [d[0] for d in cursor.description] )

	for row in cursor:
		result.append(dict(zip(columns, row)))

"""
from flask import Flask, render_template, request,json
from flaskext.mysql import MySQL
#from werkzeug import generate_password_hash, check_password_hash

#Create the app
app = Flask(__name__)
mysql = MySQL()
 
# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'root'
# this is not my actual password
app.config['MYSQL_DATABASE_PASSWORD'] = 'xxx'
app.config['MYSQL_DATABASE_DB'] = 'Treasure_Hunt'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)

# renders the home page of the website
@app.route("/")
def main():
    return render_template('index.html')
    


# renders the sign up page once the signup button is pressed    
@app.route('/showSignUp')
def showSignUp():
    return render_template('signup.html')
    
Example #10
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 #11
0
from flask import Flask, json
from flaskext.mysql import MySQL

mysql = MySQL()
app = Flask(__name__)

# MySQL configurations
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = ''
app.config['MYSQL_DATABASE_DB'] = 'start_for_x'

mysql.init_app(app)

# Insert into table
conn = mysql.connect()
cursor = conn.cursor()

data = json.loads(open('news.json').read())

for line in data:
    startup_name = line['company']
    news = line['news']
    for new in news:
        try:
            cursor.execute('''INSERT INTO startup_news (link, title, startup_name) VALUES (%s, %s, %s)''',
                   (new['link'], new['title'], startup_name))
            conn.commit()
        except:
            print new['link']
Example #12
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
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 #14
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'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'mysqlaccount'
app.config['MYSQL_DATABASE_DB'] = 'instaShare'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
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 #15
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 #16
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)
from flask import Flask, request, Response
from flaskext.mysql import MySQL
from flask.ext.cors import CORS
import json

mysql = MySQL()
app = Flask(__name__)
cors = CORS(app)

app.config['MYSQL_DATABASE_USER'] = 'user'
app.config['MYSQL_DATABASE_PASSWORD'] = 'pass'
app.config['MYSQL_DATABASE_DB'] = 'notes'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'

mysql.init_app(app)

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

@app.route('/notes', methods=['GET', 'POST', 'OPTIONS'])
def notes():
	params  = json.loads(json.dumps(request.json))

	con = mysql.connect()
	cursor = con.cursor()
	info = dict()

	if request.method == 'GET':
		stmt = "SELECT * FROM notes"
Example #18
0
#/usr/bin/env python
# -*- coding:utf-8 -*-

#WARNING LES BUGS AU NIVEAU DES ENVIRONNEMENTS VIRTUELS VIENNENT PTET DE LA PREMIERE LIGNE /usr/bin/env python
from flask import Flask, request
from flaskext.mysql import MySQL
import requete 

mysql = MySQL()
app = Flask(__name__)

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


@app.route("/Authenticate/")
def Authenticate():
	
    username = request.args.get('UserName')
    password = request.args.get('Password')
    
    conn = mysql.connect()
    cursor = conn.cursor()
    cursor.execute("INSERT INTO User (userId,userName,password) VALUES ('','John', 'John')")
    cursor.execute("INSERT INTO User (userId,userName,password) VALUES ('','Jean', 'Jean')")
    cursor.execute("INSERT INTO User (userId,userName,password) VALUES ('','Maria', 'Maria')")
    cursor.execute("SELECT * from User where Username='" + username + "' and Password='" + password + "'")
    conn.commit()
Example #19
0
from flask import Flask
from flask.ext.mysql import MySQL

app = Flask(__name__)
app.debug = True

mysql = MySQL()
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'ivan'
app.config['MYSQL_DATABASE_DB'] = 'tp_db'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'

mysql.init_app(app)

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

from app import User, Forum, Thread, Post, General
Example #20
0
import cv2, os, logging, shutil
from flask.ext.mysql import MySQL
import numpy as np
from PIL import Image
import json
import glob
from uuid import uuid4

app = Flask(__name__)
mysql = MySQL()

faceCascadeFile = 'OnYourFace/static/cascades/facesCascade.xml'

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

class Details(object):
    firstName = ""
    lastName = ""
    location = ""
    birthdate = ""
    confidence = 0
    def __init__(self, firstName, lastName, location, birthdate, confidence):
        self.firstName = firstName
        self.lastName = lastName
        self.location = location
        self.birthdate = birthdate
        self.confidence = confidence
Example #21
0
from flask.ext.mysql import MySQL
#from flask.mysql import MySQL
import os
import logging
from logging.handlers import RotatingFileHandler

mysql = MySQL()
#app = Flask(__name__,static_url_path='')
app = Flask(__name__)

cuenta=0

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = os.environ.get('BDB_MYSQL_USER')
app.config['MYSQL_DATABASE_PASSWORD'] = os.environ.get('BDB_MYSQL_PASS')
app.config['MYSQL_DATABASE_DB'] = os.environ.get('BDB_MYSQL_DB')
app.config['MYSQL_DATABASE_HOST'] = os.environ.get('BDB_MYSQL_HOST')
mysql.init_app(app)


# Render templates

@app.route('/perfmon/')
@app.route('/perfmon/<cust>')
def perfmon(cust=None):

        kpi="RegisteredPhones"
        domain="/UK%"

        # All Good, let's call MySQL
        conn = mysql.connect()
Example #22
0
from flask import Flask, render_template, json, request,redirect,session,jsonify, url_for
from flask.ext.mysqldb import MySQL
from werkzeug import generate_password_hash, check_password_hash
from werkzeug.wsgi import LimitedStream
import uuid
import os

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

# MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] ='qburst'
app.config['MYSQL_DATABASE_DB'] = 'emailSpam'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
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
Example #23
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 #24
0
	Flask,
	render_template,
	request,
	redirect,
	url_for,
	Blueprint
)
from flaskext.mysql import MySQL
app = Flask(__name__)

logged_in = 0

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

#app = Blueprint('metro', __name__)

# @app.route('/')
# def home():
# 	return redirect('/metro')

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

@app.route('/info/')
def info():
from wtforms.validators import Required

from flask import Flask
from flaskext.mysql import MySQL
from flask import render_template
from flask import jsonify
from flask import request
import json
import random
import os

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

# @app.route("/")
# def one_html():
# 	return render_template("Bar_Chat.html", title = 'Projects')@app.route("/")
@app.route("/test")
def test():
	return jsonify({"hello":"dear"})

@app.route("/")
def one_html():
	return render_template("Bar_Chat.html", title = 'Projects')

@app.route("/word_count")
Example #26
0

from flask import Flask, url_for, render_template, request , json, session, redirect
from flask.ext.mysql import MySQL
from werkzeug.security import generate_password_hash, check_password_hash
import uuid
import os

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

 # MySQL configurations
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'dbgood'
app.config['MYSQL_DATABASE_DB'] = 'dbDeskProject'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
app.config['UPLOAD_FOLDER'] = 'static/Uploads'
mysql.init_app(app)




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

@app.route('/upload', methods=['GET', 'POST'])
def upload():
    if request.method == 'POST':
    	file = request.files['file']
__author__ = 'kai'
import json
from flask import Flask, render_template
from flaskext.mysql import MySQL
app = Flask(__name__)
mysql = MySQL()
mysql.init_app(app)
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = '881220wk'
app.config['MYSQL_DATABASE_DB'] = 'WeatherData'
app.config['DEBUG'] = True


@app.route("/test")
def hello():
    cursor = mysql.get_db().cursor()
    cursor.execute('SELECT Tmax FROM weather where WBAN = "3013"')
    rows = cursor.fetchall()
    return json.dumps(rows)

@app.route("/")
def mainPage():
    return render_template('weather.html')

@app.route("/citylist")
def cityList():
    cursor = mysql.get_db().cursor()
    cursor.execute('SELECT cityName FROM cityMap')
    rows = cursor.fetchall()
    result = []
    for city in rows:
Example #28
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/",
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, json, render_template, request
from flask.ext.mysql import MySQL

app = Flask(__name__)

mysql = MySQL()

#MySQL configs
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = '+r1t0n$k1k1b0uDiN'
app.config['MYSQL_DATABASE_DB'] = 'lacetest1'
app.config['MYSQL_DATABASE_HOST'] = 'localhost'
mysql.init_app(app)

conn = mysql.connect()

cursor = conn.cursor()

 

@app.route('/search')
def search():
  _term1 = request.form['searchTerm1']
  _term2 = request.form['searchTerm2']
  _term3 = request.form['searchTerm3'] 

  if _term1:
    return json.dumps({'html':'<span>Valid input!</span>'})
  else:
    return json.dumps({'html':'<span>Please enter a search term.!</span>'})