Download django-nonrel
Several zip files are needed from the following repositories:
- https://github.com/django-nonrel/django/tree/nonrel-1.5-beta
- https://github.com/django-nonrel/djangoappengine/tree/appengine-1.5-beta
- https://github.com/django-nonrel/djangotoolbox/tree/toolbox-1.5-beta
- https://bitbucket.org/twanschik/django-autoload
- https://github.com/django-nonrel/django-dbindexer/tree/dbindexer-1.5-beta
- https://github.com/django-nonrel/django-testapp/tree/testapp-1.5-beta
After downloading the zip files, I unzip them into the directory django-nonrel in my home directory. The end result is the following:
$ ls -F ~/django-nonrel
django-dbindexer-dbindexer-1.5-beta/
django-testapp-testapp-1.5-beta/
djangotoolbox-toolbox-1.5-beta/
django-nonrel-1.5-beta/
djangoappengine-appengine-1.5-beta/
twanschik-django-autoload-1698ab544030/
Setup the Django project
Next I have to deviate from the common way of creating Django project. Instead of django-admin.py startproject, the following steps are used:
- Copy the django-nonrel test application directory to the project directory. My project directory name is DjangoNonrel:
$ cd ~/DjangoProjects
$ cp -R ~/django-nonrel/django-testapp-testapp-1.5-beta DjangoNonrel - Configure django-nonrel for the newly created project:
$ cd ~/DjangoProjects/DjangoNonrel
$ ln -s ~/django-nonrel/django-nonrel-1.5-beta/django/ django
$ ln -s ~/django-nonrel/django-dbindexer-dbindexer-1.5-beta/dbindexer/ dbindexer
$ ln -s ~/django-nonrel/djangotoolbox-toolbox-1.5-beta/djangotoolbox/ djangotoolbox
$ ln -s ~/django-nonrel/twanschik-django-autoload-1698ab544030/autoload/ autoload
$ ln -s ~/django-nonrel/djangoappengine-appengine-1.5-beta/djangoappengine/ djangoappengine
A quick sanity check is due. I start the server the usual way,
$ ./manage.py runserver
then load http://localhost:8000/ to the web browser. The rendered page contains the "It works!" heading. Everything seems to work so far.
Deploy to Google App Engine
Time to try out the real target - the Google app engine. Here's what works for me:
- Go to http://appengine.google.com/ to create a Google app engine application. What matters at this point is the name of the application. I name my application "django-on-gae".
- Enter the application name to app.yaml. The first line of my app.yaml is:
application: django-on-gae - Since the Google app engine applications are deployed to the domain ".appspot.com", this domain needs to be added to ALLOWED_HOSTS in ~/django-nonrel/django-nonrel-1.5-beta/django/conf/global_settings.py. I set mine to this:
ALLOWED_HOSTS = ['.appspot.com'] - Deploy the application to Google app engine:
$ ./manage.py deploy
The same sanity check is now repeated on Google app engine. The page http://django-on-gae.appspot.com/ rendered the same "It works!" page. Yeah!
No comments:
Post a Comment