Setting up development environment for Google App Engine and Python


Google App Engine is a PAAS offering from Google Cloud Platform, which enables you to build complex web solutions with significant ease without worrying too much about the scalability or infrastructure management. If you want to develop GAE applications using python and looking for a way to setup your development environment then this post is for you.

Installing GAE SDK

This is the easiest part, I am using the windows machine, so I can simply grab the installer from this link and then install it following the installation wizard like you have done million times already.

I am assuming since you are reading this post you must be a python developer and using the PyCharm as your IDE, but if you do not have PyCharm installed then you can install is from here.

PyCharm community edition does not come with GAE support out of the box, so you need to make changes here and there to make it work for you.

Make autocomplete work for GAE SDK in pycharm

Typically when you start building an application in python, you start with setting up a virtual environment, however when you are building GAE application, setting up virtual environment seems an overkill to me, since GAE in itself works like a container and ensures isolation. You can also not install GAE packages using pip since those get installed in your machine when you install SDK.

The most straight forward way to make GAE packages available to PyCharm is, by setting a hard symlink from GAE packages directory to python site_packages directory. To do this you need to open command prompt in elevated access mode (run as admin) and execute following commands:

mklink /J "C:\Python27\Lib\site-packages\google" "C:\Program Files (x86)\Google\google_appengine\google"

Make sure you change the paths correctly to reflect your machine specific paths.

Scaffolding basic GAE app

GAE application needs a few config files in order to get insights about your project and configure it during deployment in GAE. You can very well create these files manually following the GAE documentation, but I find this easier to generate a basic project structure using Google App Engine Launcher, which gets installed with GAE SDK.

Open the GAE Launcher, go to File->Create New Application, enter application name and create the application. Do not run the application from GAE launcher, we were only interested in the generated files.

Now go to the root directory of the generated application, change the name to whatever you want to name your project and open this directory in PyCharm.

Enable Debugging

In order to debug you GAE application, you need to perform following steps:

  • Go to Run -> Edit Configurations
  • Click on the + symbol to add new configuration and select Python
  • Enter a name which you can remember like “Execute_GAE”
  • In the Script section enter C:\Program Files (x86)\Google\google_appengine\, change the path to point to your machines GAE intallation path
  • In the Script parameters section enter --automatic_restart=no --max_module_instances="default:1" .
  • In the Working directory section enter the path of the root directory of your project(the one with the app.yaml in it)
  • Tick the share checkbox, it will create a idea configuration file in .idea directory
  • Ensure that under File -> Settings -> Build, Execution, Deployment -> Python Debugger you have Attach to subprocess automatically while debugging option enabled.

Now you are good to start building GAE apps using PyCharm with debugging enabled.

One thought on “Setting up development environment for Google App Engine and Python

  1. Sowmyanarayan R September 21, 2016 / 10:31 am

    Would help if you put in a bit of details on how to get “PyCharm community edition” work with GAE


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s