下面是我具体遇到的问题和解决方法:
错误详细信息:
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 call settings.configure() before accessing settings.
解决方法一:
Main代码或models.py中引入包:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myweb.settings' # myweb是改成自己的项目名称
解决方法二:
命令行运行程序之前运行以下命令或者在bat 批处理文件中增加这句话;
set DJANGO_SETTINGS_MODULE=myweb.settings