django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法

来源:互联网 发布:上海软件开发培训班 编辑:程序博客网 时间:2024/06/05 09:35

在python的开发中,遇到了这个错误: 
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. 
解决方法如下: 
在代码文件的最上方,添加如下代码:

注意,用的是python2.7.6版本

import os,djangoos.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings")# project_name 项目名称django.setup()
阅读全文
0 0
原创粉丝点击