django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not

在centos7下安装了pycharm,但是每次在shell窗口输入  import viewclass.models as models 来引入模块,结果报错:

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.

但是程序用python manage.py runserver 启动却正常,google里面有好多解决办法,但是都不适用。

解决办法:

在shell窗口输入 python manage.py shell

然后在输入 import viewclass.models as models 来引入。

你可能感兴趣的:(python,python)