Beispiel #1
0
if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-p",
                        "--port",
                        default=3031,
                        type=int,
                        help="the port to expose")
    parser.add_argument("-d",
                        "--debug",
                        action="store_true",
                        help="debugging interface")
    parser.add_argument("-f",
                        "--filename",
                        default=None,
                        help="a Python file with the app settings")
    args = parser.parse_args()
    print("port: {0}".format(args.port))
    print("config: {0}".format(args.filename))

    app = create_app(args.filename)
    if args.debug:
        run_simple("0.0.0.0",
                   args.port,
                   app,
                   use_reloader=True,
                   use_debugger=True)
    else:
        http_server = HTTPServer(WSGIContainer(app))
        http_server.listen(args.port)
        IOLoop.instance().start()
Beispiel #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from osrc import create_app

if __name__ == "__main__":
    app = create_app()
    app.debug = True
    app.run()
Beispiel #3
0
    pipe.execute()


if __name__ == "__main__":
    import argparse
    from osrc import create_app

    # Parse the command line arguments.
    parser = argparse.ArgumentParser(
        description="Add expiry dates to everything")
    parser.add_argument("--config",
                        default=None,
                        help="The path to the local configuration file.")
    parser.add_argument("--log",
                        default=None,
                        help="The path to the log file.")
    args = parser.parse_args()

    largs = dict(level=logging.INFO,
                 format="[%(asctime)s] %(name)s:%(levelname)s:%(message)s")
    if args.log is not None:
        largs["filename"] = args.log
    logging.basicConfig(**largs)

    # Initialize a flask app.
    app = create_app(args.config)

    # Set up the app in a request context.
    with app.test_request_context():
        set_expire()
Beispiel #4
0
if __name__ == "__main__":
    import argparse
    from osrc import create_app

    # Parse the command line arguments.
    parser = argparse.ArgumentParser(
        description="Add expiry dates to everything")
    parser.add_argument("--config", default=None,
                        help="The path to the local configuration file.")
    parser.add_argument("--log", default=None,
                        help="The path to the log file.")
    parser.add_argument("--connections", action="store_true",
                        help="Delete the connections?")
    args = parser.parse_args()

    largs = dict(level=logging.INFO,
                 format="[%(asctime)s] %(name)s:%(levelname)s:%(message)s")
    if args.log is not None:
        largs["filename"] = args.log
    logging.basicConfig(**largs)

    # Initialize a flask app.
    app = create_app(args.config)

    # Set up the app in a request context.
    with app.test_request_context():
        if args.connections:
            del_connections()
        else:
            set_expire()
Beispiel #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from osrc import create_app

if __name__ == "__main__":
    app = create_app("../local.py")
    app.debug = True
    app.run()
Beispiel #6
0
        return None

    result = r.json().get("rawOffset", None)
    if result is None:
        return None
    return int(result / (60*60))

########NEW FILE########
__FILENAME__ = run
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from osrc import create_app

if __name__ == "__main__":
    app = create_app("../local.py")
    app.debug = True
    app.run()

########NEW FILE########
__FILENAME__ = set_expire
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import (division, print_function, absolute_import,
                        unicode_literals)

import logging
from itertools import imap
from osrc.database import get_pipeline, format_key
Beispiel #7
0
Datei: run.py Projekt: dfm/osrc
from tornado.ioloop import IOLoop
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer

from werkzeug.serving import run_simple

from osrc import create_app

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-p", "--port", default=3031, type=int,
                        help="the port to expose")
    parser.add_argument("-d", "--debug", action="store_true",
                        help="debugging interface")
    parser.add_argument("-f", "--filename",
                        default=None,
                        help="a Python file with the app settings")
    args = parser.parse_args()
    print("port: {0}".format(args.port))
    print("config: {0}".format(args.filename))

    app = create_app(args.filename)
    if args.debug:
        run_simple("0.0.0.0", args.port, app, use_reloader=True,
                   use_debugger=True)
    else:
        http_server = HTTPServer(WSGIContainer(app))
        http_server.listen(args.port)
        IOLoop.instance().start()