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

解决办法很简单:

在项目的最上方加上:

import os,django
os.environ.setdefault("DJANGO_SETTINGS_MODULE","project_name.settings")# project_name 项目名称
django.setup()

 

posted @ 2019-09-30 10:18  青春叛逆者  阅读(236)  评论(0编辑  收藏  举报