mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
feat(import_app): print original exception on AppImportError (#1334)
* feat(import_app): print original exception on AppImportError
This commit is contained in:
parent
6dbbaa595b
commit
915c534eab
@ -24,6 +24,7 @@ import inspect
|
||||
import errno
|
||||
import warnings
|
||||
import cgi
|
||||
import logging
|
||||
|
||||
from gunicorn.errors import AppImportError
|
||||
from gunicorn.six import text_type
|
||||
@ -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:
|
||||
@ -565,4 +569,4 @@ def make_fail_app(msg):
|
||||
])
|
||||
return [msg]
|
||||
|
||||
return app
|
||||
return app
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user