What you use it for is to create you own custom shell. Django does this nicely with it's shell management command. I often find myself doing this:
$ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from this import that >>> from module import something >>> from db import connection >>> con = connection('0.0.0.0', bla=True) >>> con.insert(something(that))
And there's certain things I almost always import (depending on the project). So use
code to write your own little custom shell loader that imports all the stuff you need. Here's one I wrote real quick. Ultra useful time-saver:
#!/usr/bin/env python import code, re if __name__ == '__main__': from apps.main.models import * from mongokit import Connection from pymongo.objectid import InvalidId, ObjectId con = Connection() db = con.worklog print "AVAILABLE:" print '\n'.join(['\t%s'%x for x in locals().keys() if re.findall('[A-Z]\w+|db|con', x)]) print "Database available as 'db'" code.interact(local=locals())
This is working really well for me and saving me lots of time. Hopefully someone else finds it useful.