Tom X. Tobin wrote:
> #!/usr/bin/env ipython -i -nobanner
> Save that to a file in your PATH, make it executable, and you should be set.
Awesome--thanks. And, instead of chmod +x-ing it, I added it to our
common fab files, so everyone gets it with 'fab shell'.
And I could not get ip = IPython.ipapi.get() working (not sure why -
it returned a None), so I added it with this contemptible but
bulletproof hack:
def shell():
open('.ipython', 'w').write('''
# don't need this part if DJANGO_SETTINGS_MODULE is already set in
your environment
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'dev2_settings' # TODO look
up which one
from django.db.models import Count, Max, Min, Q
from django.db.models.loading import cache as appcache
local_dict = locals()
for model_class in appcache.get_models():
local_dict[model_class.__name__] = model_class
del local_dict, appcache, os
''')
os.system('ipython -i -nobanner .ipython')
--
Phlip
http://c2.com/cgi/wiki?ZeekLand
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.