import时报错django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or ca
ll settings.configure() before accessing settings.解决办法:在文件开头加入
import os,djangoos.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings")# project_name 项目名称django.setup()