Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A streamlined django setup for appengine
Python Shell

Fix indentation

latest commit c04bb9bb52
Martin Allison authored
Failed to load latest commit information.
core Fix indentation
lib Rename NdbTestCase -> AppEngineTestCase (with backwards compatibility…
tmp Empty tmp folder so that the datastore stub will work
.gitignore Don't ignore gitignore
__init__.py
app.yaml Fixed some todos, cleaned up the codebase
cron.yaml Fixed some todos, cleaned up the codebase
favicon.ico
main.py A little tidy of imports and comments.
manage.py Make manage.py executable
readme.md Support for different django paths in GAE 1.7.5
serve.sh Update serve.sh to curry dev_appserver with some more default args. C…
settings.py Fixed some todos, cleaned up the codebase
shell.py Fixed some todos, cleaned up the codebase
test.sh added test bash script to run tests
urls.py Fixed some todos, cleaned up the codebase

readme.md

A streamlined Django 1.4 and App Engine integration.

Requirements

Google Appengine Python SDK 1.7.5+

Getting started

Run locally:

git clone git@github.com:potatolondon/djappengine.git
cd djappengine
./serve.sh

Visit http://localhost:8080 to marvel at your work.

Now deploy to appspot, first set up an app on http://appengine.google.com and replace application in app.yaml with the name of your app (in your text editor or like this):

sed -i '' 's/djappeng1ne/myappid/' app.yaml

You're ready to deploy:

appcfg.py update .

The Django app in core is there to get you started. Have a look around.

Local shell

With your local server stopped, open a python shell and play with your local data:

./shell

Running tests

python manage.py test core
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

djappengine uses a custom test runner that doesn't try to use a database. This is because djappengine is designed primarily to be used with App Engine's models, and not with Django's ORM. If you're using CloudSQL, comment out the TEST_RUNNER line in settings.py.

core/tests.py is an example test that sets App Engine's testbed.

So what's going on?

app.yaml

  • Sets up static resources
  • Points all other paths to the WSGI app

main.py

  • Sets the DJANGO_SETTINGS_MODULE environment var
  • Routes logging for production
  • Defines the WSGI app

manage.py

  • Uses path-fixing mechanisms in order for tests to run properly

settings.py

  • Usual Django defaults
  • Sets the SESSION_ENGINE to a custom memcache/datastore session backend

lib/environ.py

  • Uses various internal SDK functions to set up the system environment in such a way that things will run in the context of Appengine's service stubs

lib/memcache.py

  • So App Engine's memcache is seen by django

lib/testrunnernodb.py

  • A custom test runner that lets you use Django's simple test runner to run tests with App Engine's testbed and without a database.

core

  • A simple example app to get you started

What's missing

Something missing? please raise an issue.

Something went wrong with that request. Please try again.