Installing the Google App Engine SDK and Django 1.0.2

May 6th, 2009

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.

9 responses

  1. Abraham Estrada comments:

    Thank you very much!

  2. Peter comments:

    Glad to help!

  3. Bubble Foundry » OpenID and oAuth on App Engine pings back:

    [...] Foundry Installing the Google App Engine SDK and Django 1.0.2 [...]

  4. Waldemar Kornewald comments:

    Instead of bundling Django yourself and working with a 90%-incompatible Django version you can also use app-engine-patch which comes pre-bundled and supports almost all of Django’s features:
    http://code.google.com/p/app-engine-patch/

  5. Peter comments:

    Hi Waldemar, my understanding that app-engine-patch only uses the version of Django installed by Google, 0.96 (0.97?). I wanted to use the latest stable version, so that’s why I chose google-app-engine-django.

  6. JP comments:

    @Peter…i believe app engine patch uses django 1.0.2. Waldemar, please correct me if I’m wrong.

  7. Peter comments:

    You are correct, JP. Waldemar told me over Twitter that it is possible to use the latest versions of Django with app-engine-patch.

  8. Kalyan Lanka comments:

    Latest version of app engine supports 10 MB of zip file. So we need not go thru zipping specific files
    running zip -r django.zip django command will do.

  9. Peter comments:

    Thanks Kalyan, knowing that will make things easier in the future!

Comments are now closed