Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(import_app): print original exception on AppImportError #1334

Merged
merged 4 commits into from Oct 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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