django中执行py报错Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured

Posted 叽叽喳喳,嘻嘻哈哈

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django中执行py报错Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured相关的知识,希望对你有一定的参考价值。

https://blog.csdn.net/heybob/article/details/49684261

django代码下面直接run的时候报错:

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.

查了下,解决办法是在模块前面添加:

import os
os.environ.update({"DJANGO_SETTINGS_MODULE": "config.settings"})

以上是关于django中执行py报错Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured的主要内容,如果未能解决你的问题,请参考以下文章

django manage.py执行命令报错,怎么回事,求大神解救

Django同步数据库(/manage.py makemigrations) 报错

python socket编程腾讯云下报错[Errno 99] Cannot assign requested address的解决方式

django报错系列django.core.exceptions.ImproperlyConfigured

Django1.6 运行manage.py 报错解决办法(ImportError)

Django :执行 python manage.py makemigrations 时报错 TypeError: __init__() missing 1 required positional a