Pre-requsite
- Under eclipse workspace directory run : django-admin.py startproject gdjtest
- New a 'PyDev Google App Engine Project' from eclipse, named 'gdjtest'
- New a GEA configuration file under project root : app.yaml, with content as below
application: gdjtest
version: 1
runtime: python27
api_version: 1
threadsafe: yes
libraries:
- name: django
version: 1.3
- url: /.*
script: djangoappengine.main.application
- Copy djangoappengin from django-nonrel to project root directory
- Start up GAE Django server : project submenu:[Run As][PyDev:Google App Run]
- Use browser to test : http://localhost:8080/
- If success, got the page response as below :
It worked!
Congratulations on your first Django-powered page.
Of course, you haven't actually done any work yet. Here's what to do next:
- If you plan to use a database, edit the
DATABASES
setting in settings/settings.py
.
- Start your first app by running
python settings/manage.py startapp [appname]
.
You're seeing this message because you have DEBUG = True
in your Django settings file and you haven't configured any URLs. Get to work!
Error Debugging
- App server startup fail : No URLMap entries found in application configuration
app.yaml loss handlers section
handlers:
- url: /.*
script: djangoappengine.main.application
- ImportError: No module named django.conf
app.yaml lose django libraries
libraries:
- name: django
version: 1.3
- ImportError: No module named gdjtest.urls
Modify settings.py, find line ROOT_URLCONF = 'gdjtest.urls' and change to ROOT_URLCONF = 'urls'
Complete app.yaml for Django on GAE:
application: optionwatch
version: 1
runtime: python27
api_version: 1
threadsafe: yes
builtins:
- remote_api: on
inbound_services:
- warmup
libraries:
- name: django
version: 1.3
- name: lxml
version: latest
handlers:
- url: /_ah/queue/deferred
script: djangoappengine.deferred.handler.application
login: admin
- url: /_ah/stats/.*
script: djangoappengine.appstats.application
- url: /media/admin
static_dir: django/contrib/admin/media
expiration: '0'
- url: /.*
script: djangoappengine.main.application