解决 控制台console导入模型报错 django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured.

import os

import  django 

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'rookie.settings')  # rookie替换你的app应用名称

django.setup()

原文地址:https://www.cnblogs.com/SunshineKimi/p/14545432.html