From 12a2820ff34efa316196c27d69274a7e8b089d82 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 20 Oct 2011 12:53:41 +0100 Subject: [PATCH] adding a shell --- bin/run_shell.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bin/run_shell.py diff --git a/bin/run_shell.py b/bin/run_shell.py new file mode 100755 index 0000000..80e726f --- /dev/null +++ b/bin/run_shell.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import code, re +import here + +if __name__ == '__main__': + + + from models import User, Tweeter, connection + from pymongo.objectid import InvalidId, ObjectId + + import settings + db = connection[settings.DATABASE_NAME] + 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())