From ddae12ceb5eff8c703647fb074e479a12ebc5ed8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 19 2016 07:58:15 +0000 Subject: Fix the runserver script so that APP is imported when setting the profiler --- diff --git a/runserver.py b/runserver.py index 71056d3..8cae113 100755 --- a/runserver.py +++ b/runserver.py @@ -32,11 +32,6 @@ parser.add_argument( args = parser.parse_args() -if args.profile: - from werkzeug.contrib.profiler import ProfilerMiddleware - APP.config['PROFILE'] = True - APP.wsgi_app = ProfilerMiddleware(APP.wsgi_app, restrictions=[30]) - if args.config: config = args.config if not config.startswith('/'): @@ -45,5 +40,11 @@ if args.config: os.environ['PKGDB2_CONFIG'] = config from pkgdb2 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)