Google App EngineでDjango-nonrelを使ってみる。

Google App EngineDjango-nonrelを使ってみます。

参考
joinwithjack: django-nonrel on GAE

django-nonrelのインストールします。

hgコマンドでソースファイルを取得して、projectのディレクトリにシムリンクをはります。

hg clone http://bitbucket.org/wkornewald/django-testapp
hg clone http://bitbucket.org/wkornewald/djangoappengine
hg clone http://bitbucket.org/wkornewald/djangotoolbox
hg clone http://bitbucket.org/wkornewald/django-nonrel
django-testapp配下をコピーします。

django-testappは、プロジェクトの雛形です。
自分のプロジェクトディレクトリ配下にコピーします。

Google App Engineに新規アプリを作成します。

ログイン - Google アカウント

app.yamlファイルを編集します。
  • ctst -> 新規アプリ名
ローカルでテストします。
./manage.py createsuperuser
./manage.py syncdb
./manage.py runserver

http://localhost:8000/

デプロイします。
./manage.py deploy
GAEで確認します。

http://.appspot.com

Admin画面の準備をします。
vi app.yaml
---
builtins:  
- remote_api: on  
- datastore_admin: on  <- 追加  
---

./manage.py remote createsuperuser
vi urls.py
---
from django.views.generic.simple import direct_to_template
from django.contrib import admin

admin.autodiscover()

handler500 = 'djangotoolbox.errorviews.server_error'

urlpatterns = patterns('',
        ('^_ah/warmup$', 'djangoappengine.views.warmup'),
        (r'^admin/', include(admin.site.urls)), # Enabling Admin 
        ('^$', direct_to_template,{'template': 'home.html'}),
    )
---

./manage.py syncdb
./mange.py runserver

http://localhost:8000/admin

./mange.py deploy

http://<Urappid>.appspot.com/admin