def set_debug_mode(app): from werkzeug.debug import DebuggedApplication app = DebuggedApplication(app) # profiling if settings.debug_level() == settings.DEBUG_AND_PROFILE: from werkzeug.middleware.profiler import ProfilerMiddleware app = ProfilerMiddleware(application, sys.stdout) profile_log_path = settings.get('global', 'profile_log_path') if profile_log_path: app = ProfilerMiddleware(app, open(profile_log_path), 'w') return app
def test_debug_level(self): self.assertEqual(settings.debug_level(), 0)
if not settings.get_bool('global', 'maintenance'): application = KonTextWsgiApp() else: application = MaintenanceWsgiApp() robots_path = os.path.join(os.path.dirname(__file__), 'files/robots.txt') if os.path.isfile(robots_path): from werkzeug.wsgi import SharedDataMiddleware application = SharedDataMiddleware(application, {'/robots.txt': robots_path}) if settings.is_debug_mode(): from werkzeug.debug import DebuggedApplication application = DebuggedApplication(application) # profiling if settings.debug_level() == settings.DEBUG_AND_PROFILE: from werkzeug.contrib.profiler import ProfilerMiddleware, MergeStream stream = MergeStream( sys.stdout, open(settings.get('global', 'profile_log_path'), 'w')) application = ProfilerMiddleware(application, stream) if __name__ == '__main__': from werkzeug.serving import run_simple from werkzeug.wsgi import SharedDataMiddleware import argparse DEFAULT_PORT = 5000 DEFAULT_ADDR = '127.0.0.1' parser = argparse.ArgumentParser( description='Starts a local development server')
application = KonTextWsgiApp() else: application = MaintenanceWsgiApp() robots_path = os.path.join(os.path.dirname(__file__), 'files/robots.txt') if os.path.isfile(robots_path): from werkzeug.wsgi import SharedDataMiddleware application = SharedDataMiddleware(application, { '/robots.txt': robots_path }) if settings.is_debug_mode(): from werkzeug.debug import DebuggedApplication application = DebuggedApplication(application) # profiling if settings.debug_level() == settings.DEBUG_AND_PROFILE: from werkzeug.contrib.profiler import ProfilerMiddleware, MergeStream stream = MergeStream(sys.stdout, open(settings.get('global', 'profile_log_path'), 'w')) application = ProfilerMiddleware(application, stream) if __name__ == '__main__': from werkzeug.serving import run_simple from werkzeug.wsgi import SharedDataMiddleware import argparse DEFAULT_PORT = 5000 DEFAULT_ADDR = '127.0.0.1' parser = argparse.ArgumentParser(description='Starts a local development server') parser.add_argument('--port', dest='port_num', action=None, default=DEFAULT_PORT,