示例#1
0
def fetch_all_routes():
    app = create_app(__name__)
    with app.app_context():
        for route_id in range(3014600, 3015000, 100):
            log.info('Fetching route {}...'.format(route_id))
            try:
                store_route_info(route_id)
            except:
                time.sleep(10)
示例#2
0
def fetch_all_routes():
    app = create_app(__name__)
    with app.app_context():
        for route_id in range(3014600, 3015000, 100):
            log.info('Fetching route {}...'.format(route_id))
            try:
                store_route_info(route_id)
            except:
                time.sleep(10)
示例#3
0
def test():
    app = create_app(__name__)
    with app.app_context():
        # stations_in_boundary = Station.get_stations_in_bound(37.482436, 127.017697, 37.520295, 127.062329).all()
        #
        # stations = Map.phase1(starting_point=Point(37.497793, 127.027611), radius=500, stations=stations_in_boundary)
        #
        # # for station in stations_in_boundary:
        # #     if station.cost == float('inf'):
        # #         print(station, station.edges)
        #
        # graph = Map.build_graph(stations)
        # Map.calculate_distance_for_all_nodes(graph, 2559)

        print(list(Station.get(5378).get_bus_route_ids()))
示例#4
0
def test():
    app = create_app(__name__)
    with app.app_context():
        # stations_in_boundary = Station.get_stations_in_bound(37.482436, 127.017697, 37.520295, 127.062329).all()
        #
        # stations = Map.phase1(starting_point=Point(37.497793, 127.027611), radius=500, stations=stations_in_boundary)
        #
        # # for station in stations_in_boundary:
        # #     if station.cost == float('inf'):
        # #         print(station, station.edges)
        #
        # graph = Map.build_graph(stations)
        # Map.calculate_distance_for_all_nodes(graph, 2559)

        print(list(Station.get(5378).get_bus_route_ids()))
示例#5
0
def app(request):
    """Session-wide test `Flask` application."""
    settings_override = {
        "TESTING": True,
        # 'SQLALCHEMY_DATABASE_URI': TEST_DATABASE_URI,
    }
    app = create_app(__name__, config=settings_override, template_folder="../templates")

    # Establish an application context before running the tests.
    ctx = app.app_context()
    ctx.push()

    def teardown():
        ctx.pop()

    request.addfinalizer(teardown)
    return app
示例#6
0
def app(request):
    """Session-wide test `Flask` application."""
    settings_override = {
        'TESTING': True,
        # 'SQLALCHEMY_DATABASE_URI': TEST_DATABASE_URI,
    }
    app = create_app(__name__,
                     config=settings_override,
                     template_folder='../templates')

    # Establish an application context before running the tests.
    ctx = app.app_context()
    ctx.push()

    def teardown():
        ctx.pop()

    request.addfinalizer(teardown)
    return app


# @pytest.fixture(scope='session')
# def db(app, request):
#     """Session-wide test database."""
#     if os.path.exists(TESTDB_PATH):
#         os.unlink(TESTDB_PATH)
#
#     def teardown():
#         _db.drop_all()
#         os.unlink(TESTDB_PATH)
#
#     _db.app = app
#     _db.create_all()
#
#     request.addfinalizer(teardown)
#     return _db
示例#7
0
def fetch_route(route_id):
    app = create_app(__name__)
    with app.app_context():
        store_route_info(route_id)
示例#8
0
def create_db():
    """Create an empty database and tables."""
    app = create_app(__name__)
    with app.app_context():
        db.create_all()
示例#9
0
def gdb():
    app = create_app(__name__)
    with app.app_context():
        import pdb
        pdb.set_trace()
        pass
示例#10
0
import os

from transporter import create_app


application = create_app(__name__)


if __name__ == '__main__':
    host = os.environ.get('HOST', '0.0.0.0')
    port = int(os.environ.get('PORT', 8002))
    debug = bool(os.environ.get('DEBUG', False))
    application.run(host, port=port, debug=debug)
示例#11
0
def fetch_route(route_id):
    app = create_app(__name__)
    with app.app_context():
        store_route_info(route_id)
示例#12
0
def create_db():
    """Create an empty database and tables."""
    app = create_app(__name__)
    with app.app_context():
        db.create_all()
示例#13
0
def gdb():
    app = create_app(__name__)
    with app.app_context():
        import pdb; pdb.set_trace()
        pass
示例#14
0
from transporter import create_app

application = create_app(__name__)

if __name__ == '__main__':
    application.run(host='0.0.0.0', debug=True)