Skip to content

Instantly share code, notes, and snippets.

@amitu
Created November 6, 2013 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitu/7331401 to your computer and use it in GitHub Desktop.
Save amitu/7331401 to your computer and use it in GitHub Desktop.
Find out why is something getting imported, as import fails in django sometimes leads to unhelpful "ImproperlyConfigured" exception
#!/usr/bin/env python
import sys, traceback
class ImportBlocker(object):
def find_module(self, fullname, path=None):
if "mobil" in fullname and "mobile" not in fullname:
print fullname
print traceback.print_stack()
raise Exception()
sys.meta_path = [ImportBlocker()]
# ... rest of manage.py ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment