is there an easy way to execute scripts on Google App Engine localhost? For instance i have few scripts to generate pilot data, it's quite painful to copy-and-paste them to the interactive console all the time.
Currently, i'm using 开发者_如何学Pythona simple bash script to do this, but i'm not sure this is the best solution.
curl --data-urlencode "code=`cat src/gen_pilot_data.py`" http://localhost:8079/_ah/admin/interactive/execute
thanks, V
Check out remote_api_shell.py, included in the SDK. This lets you run code on your local machine against APIs on your App Engine app, be they in production or on the dev_appserver.
The other option you have is to make your scripts into handlers, and simply GET or POST to the relevant URLs.
There is nothing special to do in order to execute script on AppEngine, but if you want to use AppEngine APIs you have to boot AppEngine before. I don't know the builtin one-line way, but you can take look how various projects do this:
https://bitbucket.org/wkornewald/djangoappengine/src/4f5d7a223084/boot.py
http://code.google.com/p/nose-gae/source/browse/trunk/nosegae.py?r=54
You can also try to import your script in console:
import gen_pilot_data
精彩评论