1. 程式人生 > >Django: doesn't declare an explicit app_label and isn't in an application in INSTALLED_ APPS

Django: doesn't declare an explicit app_label and isn't in an application in INSTALLED_ APPS

 出現異常: 

RuntimeError: Model class db.base_model.BaseModel doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

解決方案: 

在專案setting檔案中INSTALLED_APPS新增如下程式碼即可

INSTALLED_APPS = [
    "db",  # 註冊名為db的應用即可
]