shell tool
Django's manage tool provides shell commands to help us configure the running environment of the current project (such as connecting to the database, etc.), and you can directly execute the test python statement in the terminal.
Enter the shell by command
python manage.py shell
Import two model classes
from book.models import BookInfo,PeopleInfo
mysql view database log
Configuration
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
After commenting lines 68 and 69, restart mysql
sudo service mysql restart
Open log file
tail -f /var/log/mysql/mysql.log # 可以实时查看数据库的日志内容
# 如提示需要sudo权限,执行
# sudo tail -f /var/log/mysql/mysql.log