在django中如果想对models进行调试、不用每次都要runserver 在web界面上点点点、django自己带了字符界面的调试功能

一、完成app的注册、与models的定义:

  注册app:

django -- 对模式进行调式(pay with the api)-LMLPHP

  定义model:

django -- 对模式进行调式(pay with the api)-LMLPHP

二、调用shell调式接口:

JianglexingdeMacBook-Pro:project7 jianglexing$ python3 manage.py shell
Python 3.6.2 (v3.6.2:5fd33b5926, Jul 16 2017, 20:11:06)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> django.setup()
>>>
>>> from polls.models import Person
>>>
>>> Person.objects.all()
<QuerySet []>
>>> p=Person()
>>> p.name=''
>>> p.save()
>>> Person.objects.all()
<QuerySet [<Person: 1234>]>
>>> exit()

---

05-11 20:48