<img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1870732089876948&amp;ev=PageView&amp;noscript=1">

Troubleshooting The App Engine Development Sandbox with Virtualenv

Google App Engine (GAE) makes it easy to deploy an app to the cloud with only a click of a button. The App Engine sandbox is what programmers use to run their code locally before it’s hosted on Google infrastructure, which saves valuable development time and makes testing easy. In rare cases, an update to your computer’s operating system can conflict with the sandbox environment and cause new issues to arise.

Google App Engine Errors | Cloudbakers

This recently happened to me after I updated to Mac OS X El Capitan, so as a temporary fix I decided to set up an alternative virtual environment to continue my development work. If you find yourself having similar issues with the App Engine sandbox, you can follow these steps to get your Django app development back up and running.

Set Up Virtualenv

Virtualenv is a tool that lets you set up a virtual environment that’s separate from the rest of your system’s settings.

  1. Install virtualenv
  2. Create a virtual environment with the command: virtualenv env
  3. Access the environment with the command: source env/bin/activate

Now that you’re running in your virtual environment, python packages will be installed to the env/bin directory, instead of your system’s default directory (e.g. /Library/Python/2.7/site-packages/ on Mac OS X). You will also have a separate python installation in env/bin, so you can be assured that your python codebase is up to date and uncorrupted.

Include GAE Installer

Google App Engine Installer is a handy python package that allows developers to import the GAE Python SDK outside of the sandbox environment. Install this in your virtual environment with the command: pip install gae_installer.

Runserver Command

Now that your environment is setup, you can cd into your Django project and start your app with the command: python manage.py runserver. With your application code running again, you can continue development on urgent projects and troubleshoot your system later… or wait until the next update for Mac OS X!

We're GAE evangelists at Cloudbakers. Check out the type of work we do below!

Build your own custom application with the help of Cloudbakers!

Originally published on February 01, 2016

If you enjoyed this post, please consider sharing

Want more tech tips?
Subscribe to our IT Superhero Newsletter!