1、AppConfig 需要了解 目前理解为 注册installed_app使用,可以增加其他一些属性
2、logger 需要进一步学习,用于日志记录,理解log运行流程,特别是handler的使用,切分日志文件,理解其每天按时间记录,保持每天生成日志,删除过期日志。目前打开log日志会报错 :Resource deadlock avoided ,已关闭日志
3、makemigrations No Changes Detected 需要寻找原因, 数据库内的表已经删除,且源码内部的migrations文件夹已删除,百度有以下原因:
- migration folder You need a migrations package in your app.
- INSTALLED_APPS You need your app to be specified in the
INSTALLED_APPS
.dict - Verbosity start by running
makemigrations -v 3
for verbosity. This might shed some light on the problem. - Full path In
INSTALLED_APPS
it is recommended to specify the full module app config path 'apply.apps.MyAppConfig' - --settings you might want to make sure the correct settings file is set:
manage.py makemigrations --settings mysite.settings
- specify app name explicitly put the app name in
manage.py makemigrations myapp
- that narrows down the migrations for the app alone and helps you isolate the problem. -
model meta check you have the right
app_label
in your model meta -
Debug django debug django core script. makemigrations command is pretty much straight forward. Here's how to do it in pycharm. change your script definition accordingly (ex:
makemigrations --traceback myapp
)