Django项目中,在pycharm使用python console进行操作时导包报错如下:
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.
解决方法:
pycharm左上角file-->setting-->languages&frameworks-->Django,
勾选Enable Django Support,开启Django console。
配置好后点击ok,重启console,此时可以发现原本的python console已经变成了Django console。
再次导包,成功,bug解决。