Created
October 6, 2015 14:24
-
-
Save cmheisel/982bcc8d31cb472de043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import pprint | |
# This formats the path into a nicely readable string | |
readable_path = pprint.pformat(sys.path) | |
# We'll try importing and catch the exception if it doesn't work | |
try: | |
import django | |
except ImportError, e: | |
print "Can't import django from PATH: {}".format(readable_path) | |
raise # Re-raise the exception so execution stops | |
# Access the modules __file__ attribute to see where it is | |
print "Django's location: {}".format(django.__file__) | |
try: | |
from django.core.management import execute_from_command_line | |
print "execute_from_command_line imported successfully!" | |
except ImportError, e: | |
print "Can't load execute_from_command_line from {}".format(django.core.management.__file__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment