If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions

Friday, June 10, 2016

Work with AppEngine SDK in the REPL

Working again with AppEngine for Python. Here's a small code snippet that will let you work with your code in the REPL (much better than the previous solution).
"""Initianlize GAE Python environment so you can work with it from the REPL"""
from os import environ
import sys
sys.path.insert(0, environ.get('GAE_PY_SDK', '/opt/google_appengine'))
import dev_appserver # noqa
dev_appserver.fix_sys_path()
from google.appengine.ext import testbed # noqa
tb = testbed.Testbed()
tb.activate()
tb.init_all_stubs()
view raw initgae.py hosted with ❤ by GitHub
What I do in IPython is:
In [1]: %run initgae.py

In [2]: %run app.py

And then I can work with my code and test things out.

Blog Archive