验证数据迁移时报错问题

在将数据关联到用户时,在活动状态的虚拟环境中执行迁移命令,结果表明一切顺利。但在shell中验证迁移结果是否符合预期时出现报错。

(ll_env)F:\learning_log>python manage.py migrate
Operations to perform:
     Apply all migrations: admin, auth, contenttypes, learning_logs, sessions
Running migrations:
     Applying learning_logs.0003_topic_owner… OK

验证时,输入:

from learning_logs.models import Topic

报错:

Traceback (most recent call last):
 _snip_
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

你只需翻译一下最后那句话就找到答案了