Heroku のデプロイした環境で syncdb と shell を確認
Getting Started with Django on Heroku の最後、syncdb と shell を確認。
Syncing the database
まずはデータベースを syncdb してみる。
(venv)[paraches@praches.com myHeroku]$ heroku run python manage.py syncdb Running `python manage.py syncdb` attached to terminal... up, run.4122 … You just installed Django's auth system, which means you don't have any superusers defined. Would you like to create one now? (yes/no): yes Username (leave blank to use 'u7623'): Email address: xxxxxxxx@gmail.com Password: Password (again): Superuser created successfully. Installing custom SQL ... Installing indexes ... Installed 0 object(s) from 0 fixture(s) (venv)[paraches@praches.com myHeroku]$
途中でユーザ名、メールアドレス、パスワードを聞かれるので答える。
このユーザ名とパスワードは後で Django の Admin ページにアクセスする際に使うので要メモ。
Using the Django shell
次に shell を起動。
(venv)[paraches@praches.com myHeroku]$ heroku run python manage.py shell Running `python manage.py shell` attached to terminal... up, run.7971 Python 2.7.4 (default, Apr 6 2013, 22:14:13) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from django.contrib.auth.models import User >>> User.objects.all() [<User: u7623>] >>> quit() (venv)[paraches@praches.com myHeroku]$
ちゃんと動いてる!
というわけで、以上で Getting Started with Django on Heroku は終了。