Skip to content

Commit

Permalink
feat(import_app): print original exception on AppImportError (benoitc…
Browse files Browse the repository at this point in the history
…#1334)

* feat(import_app): print original exception on AppImportError
  • Loading branch information
ptbrowne authored and tilgovi committed Oct 3, 2016
1 parent 78bb8bc commit 2384269
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gunicorn/util.py
Expand Up @@ -24,6 +24,7 @@
import errno
import warnings
import cgi
import logging

from gunicorn.errors import AppImportError
from gunicorn.six import text_type
Expand Down Expand Up @@ -384,9 +385,12 @@ def import_app(module):

mod = sys.modules[module]

is_debug = logging.root.level == logging.DEBUG
try:
app = eval(obj, mod.__dict__)
except NameError:
if is_debug:
traceback.print_exception(*sys.exc_info())
raise AppImportError("Failed to find application: %r" % module)

if app is None:
Expand Down Expand Up @@ -565,4 +569,4 @@ def app(environ, start_response):
])
return [msg]

return app
return app

0 comments on commit 2384269

Please sign in to comment.