2 # vim:fileencoding=utf-8
7 sys.path.append('/opt/google-appengine/lib/yaml/lib')
8 sys.path.append('/opt/google-appengine/lib/fancy_urllib')
10 from google.appengine.ext.remote_api import remote_api_stub
11 from google.appengine.ext import db
12 from google.appengine.api import xmpp
15 return raw_input('Username: '), getpass.getpass('Password: ')
18 print "Usage: %s app_id [host]" % (sys.argv[0],)
24 host = '%s.appspot.com' % app_id
26 remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host, secure=True)
30 import rlcompleter # Tab 补全需要这个
33 readline.parse_and_bind('tab: complete')
34 historyPath = ".gaehistory"
36 def save_history(historyPath=historyPath):
38 readline.write_history_file(historyPath)
40 if os.path.exists(historyPath):
41 readline.read_history_file(historyPath)
42 readline.set_history_length(1000)
44 atexit.register(save_history)
45 del atexit, readline, save_history, historyPath
47 code.interact('App Engine interactive console for %s' % (app_id,), None, locals())