Showing posts with label django helper. Show all posts
Showing posts with label django helper. Show all posts

Wednesday, July 22, 2009

Basic Google App Engine command line

Some basic Python SDK commands in Google App Engine
  • dev_appserver.py - the development web server
  • appcfg.py - for uploading your app to App Engine
To run a local instance of a site named mysite within the Google App Engine localserver, invoke command line:

dev_appserver.py mysite (as opposed to python manage.py runserver)

When it comes to starting a project you can opt for either the built-in 0.96 of Django that is in the SDK or alternately bootstrap a 1.x version of Django. If the built-in is satisfactory, the first step in creating the new app engine site is identical to starting a self-standing Django project:

django-admin.py startproject mysite

If you choose the latter method, you will have more flexibility with the latest features of Django. This requires a different startup. You can simply checkout the latest helper app from google code. This serves as a platform for the applications you plan to create. Here's the command line:

svn checkout http://google-app-engine-django.googlecode.com/svn/trunk/ mysite

So now you're all set with a base. Don't forget that with 1.x of Django, you have to put in the Django library locally, probably best using the zipimport method, the details of which are in an earlier post on this blog. Regardless of which Django version you opt for, creating an application is done thus:
python manage.py startapp myapp
Next, begin connecting the apps as you would in Django standalone, via urls.py. There are also special requirements using the App Engine datastore instead of an relational database. More info on the differences can be found here.

Tuesday, July 21, 2009

Google App Engine with Django 1.0

Google App Engine has offered Django 0.96 out of the box since it launched in mid 2008. That has changed as of this month.

Applications can now choose either Django 0.96 or what is currently the latest stable release, 1.0.2. This means there is no need to post a zipfile to your appspot in order to utilize the latest Django. But is it that simple? Not quite.

While the cloud has the latest version, your local server environ does not. In other words, the SDK and appspot server are a bit different. This means you still need the Django Helper to run 1.0.2 locally, where you will probably be developing your site.

I went through this process and found many resources to shed light on the procedure. Some are more suited than others, due to good but out-of-date info on the woodpile. Here's what did work:
  • Google Code documentation on the Python SDK - what I like to think of as the GAE personal web server, though it's actually that and a bit more.
  • Google documentation on the Django Helper - required reading but terse. Provides and describes a turnkey local project running Django 1.0.2.
  • Finally, from Bubble Foundry in Nederland, the paydirt, aka how to get it done, aka as direct as a battleaxe to the head. Thanks, I needed that!
Good luck setting up your dev environment. Google labs makes it not so bad after all.