This document introduces how to setting up Django 1.0 framework on Google App Engine (GAE) Application.
GAE includes Django 0.96 in the box already. However, using Django 1.0 brings you the cutting-edge power of Django framework.
The following instructions are showed on windows platform, but it applies to other platforms as well.
- Python 2.5:
Download the Python 2.5 package from Python Official Website and install.
In the following of this document, Python is assumed to be installed in C:\python25, which is the default installation path.
- Google App Engine SDK:
Again, Just download the latest SDK package from GAE Google Code Site and install.
Before installing Google App Engine SDK, Python 2.5 should be installed.
- Django 1.0:
Download Django 1.0 source package from Django Official Website, extract it and execute the following command in the extracted directory:
The Django source package will be installed under the Python installation directory (ex. C:\Python25\Lib\site-packages\django)
Starting up a Django Project
In the command-line window, switch to the project directory and execute the following commands:
(In the following of this document, the project root directory is assumed to be C:\project_root, and your GAE application name is project)
Where project should be replaced by your GAE application name.
After the command is executed, a project directory named project will be created under C:\project_root and the django project files will be generated in the project directory.
Copy Django Code to Project Directory
Copy C:\Python25\Lib\site-packages\django directory to C:\project_root\project.
(After the directory is copied, bin, conf, contrib and other directories should be in C:\project_root\project\django.
Then remove the following directories which is unused in GAE Application:
Add Files to Run Django in the GAE Application
The next step is creating GAE application files which calls the Django application handler.
These files should be placed in C:\project_root\project directory.
Where [application_name] should be replaced by your GAE application name.
Updating Django Settings
Modify the settings.py file in C:\project_root\project:
Testing the Application
Run the GAE local test server by executing the following command in the command-line window:
When the server is up and ready, open http://localhost:8080 in your browser. If you set up everything properly, you should see the Django welcome page.
ConclusionsNow you have a working Django application on Google App Engine! You can write your web application using the power from both Django framework and Google App Engine API.
- python:django_gae from Tom Chen's DirecXions wiki site
- Running Django on Google App Engine from GAE Google Code Site