Skip to content

Instantly share code, notes, and snippets.

@qingfeng
Forked from lprsd/.pythonrc.py
Created December 18, 2009 10:00
Show Gist options
  • Save qingfeng/259412 to your computer and use it in GitHub Desktop.
Save qingfeng/259412 to your computer and use it in GitHub Desktop.
try:
from django.core.management import setup_environ
import settings
setup_environ(settings)
print 'imported django settings'
try:
exec_strs = ["from %s.models import *"%apps for apps in settings.INSTALLED_APPS ]
for x in exec_strs:
try:
exec(x)
except:
print 'Not imported for %s' %x
print 'imported django models'
except:
pass
except:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment