14. How it Works - main.py import os (os.environ)[ 'DJANGO_SETTINGS_MODULE' ] = 'settings' # Standard Python imports. import sys from appengine_django import InstallAppengineHelperForDjango InstallAppengineHelperForDjango( "1.1" ) from appengine_django import have_django_zip from appengine_django import django_zip_path # Google App Engine imports. from google.appengine.ext.webapp import util # Import the part of Django that we use here. import django.core.handlers.wsgi def main (): # Ensure the Django zipfile is in the path if required. if have_django_zip and django_zip_path not in sys.path: sys.path.insert( 1 , django_zip_path) # Create a Django application for WSGI. application = django.core.handlers.wsgi.WSGIHandler() # Run the WSGI CGI handler with that application. util.run_wsgi_app(application) if __name__ == '__main__' : main()
15. How it Works – static media handling I put my static media in the folder static in my project root Then I define static_dir entries in app.yaml - url: /static/4 static_dir: static/ - url: /static static_dir: static/ - url: /.* script: main.py And in settings.py I define a MEDIA_ROOT setting that points at this path MEDIA_URL = “/static/4” for external permalinks versioned to allow media changes dynamic Django urls