def create_app_no_redis(): return webtest.TestApp(napfs.create_app(data_dir=NAPFS_DATA_DIR))
def create_app(): if not os.path.exists(NAPFS_DATA_DIR): os.mkdir(NAPFS_DATA_DIR) return webtest.TestApp( napfs.create_app(data_dir=NAPFS_DATA_DIR, redis_connection=redis_connection))
import napfs import redislite if __name__ == '__main__': parser = argparse.ArgumentParser(description='kick off the napfs server') parser.add_argument('-p', '--port', default=3035, type=int, help="specify the port to listen to") parser.add_argument('-d', '--data-dir', type=str, default="/tmp/napfs", help="specify the directory to use to write the files") args = parser.parse_args() httpd = make_server( '127.0.0.1', args.port, napfs.create_app(data_dir=args.data_dir, redis_connection=redislite.StrictRedis())) print("starting server on port %s" % args.port) print("data-dir %s" % args.data_dir) try: httpd.serve_forever() except KeyboardInterrupt: print("done")
def create_app(): if not os.path.exists(NAPFS_DATA_DIR): os.mkdir(NAPFS_DATA_DIR) return webtest.TestApp(napfs.create_app( data_dir=NAPFS_DATA_DIR, redis_connection=redis_connection))
from wsgiref.simple_server import make_server import argparse # import library import napfs import redislite if __name__ == '__main__': parser = argparse.ArgumentParser(description='kick off the napfs server') parser.add_argument('-p', '--port', default=3035, type=int, help="specify the port to listen to") parser.add_argument('-d', '--data-dir', type=str, default="/tmp/napfs", help="specify the directory to use to write the files") args = parser.parse_args() httpd = make_server( '127.0.0.1', args.port, napfs.create_app( data_dir=args.data_dir, redis_connection=redislite.StrictRedis())) print("starting server on port %s" % args.port) print("data-dir %s" % args.data_dir) try: httpd.serve_forever() except KeyboardInterrupt: print("done")