Bubble Foundry

Installing the Google App Engine SDK and Django 1.0.2

by Peter.

This was quite tricky for me, so I’m writing this down to share it with others.

  1. Install the SDK

    Simply download the SDK and install it. On Mac OS X that meant that I mounted the disk image, dragged the SDK app to my applications directory, and launched it. Make sure to give the app the necessary permission to create symlinks.

  2. Get the latest version of google-app-engine-django

    Use SVN to export the latest version of google-app-engine-django: svn export http://google-app-engine-django.googlecode.com/svn/trunk/ your-app-dir

  3. Get the latest stable version of Django

    Download from http://www.djangoproject.com/download/. Decompress it.

  4. Zip up Django

    Google Apps currently uses version 0.96 of Django and they do not plan to switch in the near future. Thus, you need to put a django.zip file in your App Engine app directory, your-app-dir. You create the file by, from the Terminal, going to the directory of the new version of Django you downloaded and typing:

    1. zip -r django.zip django/__init__.py django/bin django/core django/db django/dispatch django/forms django/http django/middleware django/shortcuts django/template django/templatetags django/test django/utils django/views
    2. zip -r django.zip django/conf -x 'django/conf/locale/*'
    3. zip -r django.zip django/contrib/__init__.py django/contrib/formtools django/contrib/auth django/contrib/sessions

      Note there is an oversight in the App Engine article about zipping Django 1.0; the last two directories are necessary.

  5. Edit settings

    Open app.yaml in your App Engine app directory and change the application name on line 1 to the name of your application. Then, open settings.py and uncomment line 83 so that django.contrib.sessions.middleware.SessionMiddleware is included.

  6. Launch the default app

    From your App Engine app directory, launch the server: python manage.py runserver. If everything went correctly you should see the server mention using zipimporter and then announce that your app is running at http://localhost:8000. Open the URL and your should see a simple welcome message.

  7. Build your app!

    Now you can get started building a Django app on App Engine. Make sure to read the article on using the Django App Engine helper to see how to start building your app.