Skip to content

Instantly share code, notes, and snippets.

@cstrap
Created July 2, 2015 14:15
Show Gist options
  • Save cstrap/13b443e7178c6521028c to your computer and use it in GitHub Desktop.
Save cstrap/13b443e7178c6521028c to your computer and use it in GitHub Desktop.
Print order imports by rewriting builtin __import__ in order to see circular references. Put this on e.g. manage.py. From [email protected] S.Federici
import __builtin__
original_import = __builtin__.__import__
def log_import(name, globals={}, locals={}, fromlist=[], level=-1):
print name
return original_import(name, globals=globals, locals=locals, fromlist=fromlist, level=level)
__builtin__.__import__ = log_import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment