Template & Context

http://localhost:8080/time/
Use template file by hand

Should touch /home/djangouser/templates/mytemplate.html & fix it.
Use django template

Notice: Don't forget to add comma in TEMPLATE_DIRS!
Notice: '/home/django/mysite/templates', not good because of tight coupling
Notice: Use '/' as path sep even in windows:
    os.path.join(os.path.dirname(__file__), 'templates').replace('\\','/'),
Without templates file, notice the TemplateDoesNotExist error in webpage.
Shortcuts: render

render() wrapper get_templates(), so the 2nd arg is the same with get_templates
Block Tag

If you use {% extends %} in a template, it must be the first template tag in that template. Otherwise, template inheritance won’t work.
If you need to get the content of the block from the parent template, use {{ block.super }}
http://localhost:8080/time/
http://localhost:8080/time/plus/3/
DB Setting

$ cd django_project_dir
$ export DJANGO_SETTINGS_MODULE=mysite.settings

>>> from django.db import connection
>>> cursor = connection.cursor()
First App

$ cd mysite
$ python ../manage.py startapp books
Modify books/model.py & Install app in settings.py
$ cd ..
$ python manage.py validate
$ python manage.py sqlall books => show the create sql statements.
$ python manage.py syncdb

http://localhost:8080/first_app/
Install Admin

$ python manage.py syncdb
    username/password: amdin/admin
    If choose not create admin during syncdb, shouldrun: python manage.py createsuperuser

http://localhost:8080/admin/
Add books to administion page

http://localhost:8080/admin/
Making Fields Optional

email = models.EmailField(blank=True)
By default, all fields have blank=False, which means blank values are not allowed.

http://127.0.0.1:8000/admin/books/author/add/