错误信息
django.core.exceptions.ImproperlyConfigured:
Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call
settings.configure() before accessing settings.
解决方案
在test.py内引入下面代码
import os,django
os.environ['DJANGO_SETTINGS_MODULE'] = 'lu_blog.settings'
django.setup()
重新运行,问题解决。