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)
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()))
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
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
def fetch_route(route_id): app = create_app(__name__) with app.app_context(): store_route_info(route_id)
def create_db(): """Create an empty database and tables.""" app = create_app(__name__) with app.app_context(): db.create_all()
def gdb(): app = create_app(__name__) with app.app_context(): import pdb pdb.set_trace() pass
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)
def gdb(): app = create_app(__name__) with app.app_context(): import pdb; pdb.set_trace() pass
from transporter import create_app application = create_app(__name__) if __name__ == '__main__': application.run(host='0.0.0.0', debug=True)