1、问题描述:在django4.0中的项目工程下新建一个book应用,在models.py中输入简单数据表数据执行出现:
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
解决思路:在环境变量中增加:DJANGO_SETTINGS_MODULE=your_project.settings,我的是bookmanager.settings,如下:
继续提示:apps aren’t loaded yet 问题,这是因为在加载应用程序和模型之前尝试访问数据。
解决思路如下: