def setUp(self): """ Set up the environnment, ran before every test. """ if '///' in DB_PATH: dbfile = DB_PATH.split('///')[1] if os.path.exists(dbfile): os.unlink(dbfile) self.session = model.create_tables(DB_PATH, debug=False) APP.logger.handlers = [] APP.logger.setLevel(logging.CRITICAL) APP.before_request(FAS._check_session)
#!/usr/bin/env python # These two lines are needed to run on EL6 __requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4'] import pkg_resources import sys from werkzeug.contrib.profiler import ProfilerMiddleware from mirrormanager2.app import APP APP.debug = True if '--profile' in sys.argv: APP.config['PROFILE'] = True APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) APP.run()
parser.add_argument( '--profile', dest='profile', action='store_true', default=False, help='Profile the web application.') parser.add_argument( '--port', '-p', default=5000, help='Port for the flask application.') parser.add_argument( '--host', default="127.0.0.1", help='Hostname to listen on. When set to 0.0.0.0 the server is available \ externally. Defaults to 127.0.0.1 making the it only visable on localhost') args = parser.parse_args() if args.config: config = args.config if not config.startswith('/'): here = os.path.join(os.path.dirname(os.path.abspath(__file__))) config = os.path.join(here, config) os.environ['MM2_CONFIG'] = config from mirrormanager2.app import APP if args.profile: from werkzeug.contrib.profiler import ProfilerMiddleware APP.config['PROFILE'] = True APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) APP.debug = True APP.run(port=int(args.port), host=args.host)
default=False, help='Profile the web application.') parser.add_argument('--port', '-p', default=5000, help='Port for the flask application.') parser.add_argument( '--host', default="127.0.0.1", help='Hostname to listen on. When set to 0.0.0.0 the server is available \ externally. Defaults to 127.0.0.1 making the it only visable on localhost') args = parser.parse_args() if args.config: config = args.config if not config.startswith('/'): here = os.path.join(os.path.dirname(os.path.abspath(__file__))) config = os.path.join(here, config) os.environ['MM2_CONFIG'] = config from mirrormanager2.app import APP if args.profile: from werkzeug.contrib.profiler import ProfilerMiddleware APP.config['PROFILE'] = True APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) APP.debug = True APP.run(port=int(args.port), host=args.host)