交互式访问数据库

>>> from books.models import *
>>> b = Book.objects.get(id=50)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/python27/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/python27/lib/python2.7/site-packages/django/db/models/query.py", line 379, in get
    self.model._meta.object_name
DoesNotExist: Book matching query does not exist.
>>> b = Book.objects.get(id=1)
>>> b.title
u'aaa'

mysql> select * from books_book;
+----+-------+------------------+--------------+
| id | title | publication_date | publisher_id |
+----+-------+------------------+--------------+
|  1 | aaa   | 2018-02-19       |            1 |
|  2 | quoto | 2018-02-19       |            2 |
+----+-------+------------------+--------------+
2 rows in set (0.00 sec)