import data_cache
import utils as ut
import dataservice
import json

ut.set_debug_mode(True)
dataservice.set_config()

t = {"playerID": "willite01", "nameLast": "Williams", "bats": "R"}
r = data_cache.compute_key("people", {"playerID": "willite01", "nameLast": "Williams", "bats": "R"}, \
                           ['nameLast', "birthCity"])


def test1():
    data_cache.add_to_cache(r, t)


#test1()


def test2():
    result = data_cache.get_from_cache(r)
    print("Result = ", result)
    print(data_cache.check_query_cache("people", t, ['nameLast', "birthCity"]))


#test2()


def test3():
Exemplo n.º 2
0
Arquivo: app.py Projeto: Tazaria/hedy
                data, key[2:], translating.normalize_newlines(value))

    data = translating.normalize_yaml_blocks(data)

    return Response(dump_yaml_rt(data),
                    mimetype='application/x-yaml',
                    headers={
                        'Content-disposition':
                        'attachment; filename=' +
                        request.form['file'].replace('/', '-')
                    })


# *** AUTH ***

from website import auth
auth.routes(app, requested_lang)

# *** START SERVER ***

if __name__ == '__main__':
    # Start the server on a developer machine. Flask is initialized in DEBUG mode, so it
    # hot-reloads files. We also flip our own internal "debug mode" flag to True, so our
    # own file loading routines also hot-reload.
    utils.set_debug_mode(True)

    # Threaded option enables multiple instances for multiple user access support
    app.run(threaded=True, debug=True, port=config['port'], host="0.0.0.0")

    # See `Procfile` for how the server is started on Heroku.
Exemplo n.º 3
0
# *** START SERVER ***


def on_server_start():
    """Called just before the server is started, both in developer mode and on Heroku.

    Use this to initialize objects, dependencies and connections.
    """
    pass


if __name__ == '__main__':
    # Start the server on a developer machine. Flask is initialized in DEBUG mode, so it
    # hot-reloads files. We also flip our own internal "debug mode" flag to True, so our
    # own file loading routines also hot-reload.
    utils.set_debug_mode(not os.getenv('NO_DEBUG_MODE'))

    # If we are running in a Python debugger, don't use flasks reload mode. It creates
    # subprocesses which make debugging harder.
    is_in_debugger = sys.gettrace() is not None

    on_server_start()

    # Threaded option enables multiple instances for multiple user access support
    app.run(threaded=True,
            debug=not is_in_debugger,
            port=config['port'],
            host="0.0.0.0")

    # See `Procfile` for how the server is started on Heroku.