Set current project
gcloud config set project [PROJECT_ID]
How to update app
To use the
gcloud app deploy command, you must specify the
gcloud app deploy --project [YOUR_PROJECT_ID]
How to clear (reset) local datastore
dev_appserver.py --clear_datastore=yes myapp
How to filter long requests
In https://console.cloud.google.com/logs/viewer in advanced filter mode
protoPayload.latency > 10s
Accessing app with remote shell
builtins: - remote_api: on
export PYTHONPATH=. python $GAE_SDK_ROOT/remote_api_shell.py -s your_app_id.appspot.com
>>> import helloworld >>> from google.appengine.ext import db
>>> # Fetch the most recent 10 guestbook entries >>> entries = helloworld.Greeting.all().order("-date").fetch(10) >>> >>> # Create our own guestbook entry >>> helloworld.Greeting(content="A greeting").put()
Setting up debug variable to be False in production
import os import webapp2 debug = os.environ.get('SERVER_SOFTWARE', '').startswith('Dev') app = webapp2.WSGIApplication(routes=[ (r'/', 'handlers.HelloWorldHandler'), ], debug=debug)
Binding IP for external excess
Add to Extra Flags box:
If you add the address
0.0.0.0 then the SDK server will respond to any IP address (and still respond to “localhost” too). Useful when you’re local IP is assigned by DHCP, i.e. changes frequently.
Installing Google App Engine under Linux
Download SDK from https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python Unzip and
sudo mv google_appengine /usr/local/google_appengine
it is important to first unzip as a normal user and then copy.
If the project is very small I would recommend native Google-written webapp framework, it is good. Wikipedia has the list of frameworks that could be used with GAE. Here are some I used (this is only for Python):
- Flask - minimalistic framework. flasktodo on GitHub may be a good starting point. At the moment, this may be my first choice. Flask-appengine-template - another good template to start with Flask development on GAE, a little bit more complex (WTForms, profiling etc.).
- Tipfy - very fast framework developed for GAE, but recently updated so that could be used without it. The current version is 1.0b, but the documentation is still behind. Very nice multi-auth module.
- Django-nonrel - it may be a good choice for somebody already very familiar with Django.