Exemplo n.º 1
0
def init_db():
	database_helper.init_db()
	return 'init_db()'
Exemplo n.º 2
0
# This module handles incoming server requests. Core back-end.

from flask import Flask, request, redirect, url_for
from geventwebsocket import WebSocketServer, WebSocketError
from geventwebsocket.handler import WebSocketHandler
from passlib.hash import sha256_crypt
from functools import wraps
import json, re, urllib

# Local modules
import database_helper as db
import websocket_helper as sockets

app = Flask(__name__, static_url_path='')

db.init_db(app)

#--- Decorators ---#


# Check if user signed in
def is_signed_in(f):
    @wraps(f)
    def wrap(*args, **kwargs):
        token = request.headers.get('token')
        if token and db.get_email_by_token(token):
            return f(*args, **kwargs)
        else:
            return json.dumps({
                'success': False,
                'message': "You are no longer signed in."
Exemplo n.º 3
0
def init():
    database_helper.init_db(app);
    return render_template('hello.html',message = "database initiated")
Exemplo n.º 4
0
def init_db():
	database_helper.init_db()
	return 'init_db()'
Exemplo n.º 5
0
def init_database():
    with app.app_context():
        database_helper.init_db(DATABASE)
Exemplo n.º 6
0
def test():
    database_helper.init_db()
    return "open DB"
Exemplo n.º 7
0
def initdb_command():
    database_helper.init_db(app)
    print("db initialized")
Exemplo n.º 8
0
def hello():
    database_helper.init_db()

    return "world, hello"
Exemplo n.º 9
0
def main():
    db = database_helper.get_db()
    database_helper.init_db()
    return app.send_static_file('client.html')
Exemplo n.º 10
0
def main():
    db = database_helper.get_db()
    database_helper.init_db()
    #return render_template('static/client.html')
    return app.send_static_file('client.html')
Exemplo n.º 11
0
def init_twidder():
    db.init_db()  ##initiates database with schema.sql script
    print("Initiation done!")
Exemplo n.º 12
0
            country):
    database_helper.sign_up(email=email, password=password,
                            firstname=firstname, familyname=familyname,
                            gender=gender, city=city, country=country)
    return "SIGN UP"

def sign_out(token):
    raise NotImplementedError

def change_password(token, old_password,
                    new_password):
    raise NotImplementedError

def get_user_data_by_token(token):
    raise NotImplementedError

def get_user_data_by_email(token, email):
    raise NotImplementedError

def get_user_messages_by_token(token):
    raise NotImplementedError

def get_user_messages_by_email(token, email):
    raise NotImplementedError

def post_message(token, message, email):
    raise NotImplementedError

if __name__ == "__main__":
    database_helper.init_db()
    app.run(debug=True)
Exemplo n.º 13
0
def doinitdb():
    database_helper.init_db()
    return 'DB INIT OK'