Installing the Google App Engine SDK and Django 1.0.2
May 6th, 2009This was quite tricky for me, so I’m writing this down to share it with others.
-
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.
-
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 -
Get the latest stable version of Django
Download from http://www.djangoproject.com/download/. Decompress it.
-
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.zipfile 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: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/viewszip -r django.zip django/conf -x 'django/conf/locale/*'zip -r django.zip django/contrib/__init__.py django/contrib/formtools django/contrib/auth django/contrib/sessionsNote there is an oversight in the App Engine article about zipping Django 1.0; the last two directories are necessary.
-
Edit settings
Open
app.yamlin your App Engine app directory and change the application name on line 1 to the name of your application. Then, opensettings.pyand uncomment line 83 so thatdjango.contrib.sessions.middleware.SessionMiddlewareis included. -
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. -
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.
May 10th, 2009 at 5:21 am
Thank you very much!
May 10th, 2009 at 8:47 am
Glad to help!
May 11th, 2009 at 3:27 am
[...] Foundry Installing the Google App Engine SDK and Django 1.0.2 [...]
May 14th, 2009 at 12:39 pm
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/
May 14th, 2009 at 12:54 pm
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.
May 20th, 2009 at 7:51 am
@Peter…i believe app engine patch uses django 1.0.2. Waldemar, please correct me if I’m wrong.
May 20th, 2009 at 8:08 am
You are correct, JP. Waldemar told me over Twitter that it is possible to use the latest versions of Django with app-engine-patch.
May 29th, 2009 at 12:18 am
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.
May 29th, 2009 at 12:36 am
Thanks Kalyan, knowing that will make things easier in the future!