pycharm 中的 Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE 问题解决

昨天遇到一个问题,pycharm 中运行不了django的程序,看错误是: django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. 结果百度了半天没结果,最后还是在 老外的网站上找到了答案。 本来django项目在 python shell 中可以完美运行,在pycharm里面就不行,原因是pycharm 要你配置一个 环境变量 DJANGO_SETTINGS_MODULE 这个变量告诉django项目去找哪一个settings 文件。 具体的步骤:

1、Run –> EditConfigures

2、找到python一项 具体名字是 Python tests(注意不是django那一个),然后修改里面的Environment variables 添加一项。名称是DJANGO_SETTINGS_MODULE 值是 你的settings,比如 mysite.settings 。

转自:[http://www.cnblogs.com/lout/articles/4149591.html]

原文地址:https://www.cnblogs.com/ontoweb-zp/p/9164448.html

时间: 2024-10-29 05:07:59

pycharm 中的 Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE 问题解决的相关文章

django模板报错:Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define

转自:http://blog.csdn.net/xiaowanggedege/article/details/8651236 django模板报错: Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before a

django模板报错Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define

django模板报错Requested setting TEMPLATE_DEBUG, but settings are not configured. You must either define 分类: Django2013-03-16 22:42 2417人阅读 评论(1) 收藏 举报 djangoerror [plain] view plaincopy django模板报错 Requested setting TEMPLATE_DEBUG, but settings are not co

django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configur

django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. import xadmin时出了这个问

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 DJAN

eclipse中使用Maven插件报错:-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.

步骤: 1.添加M2_HOME的环境变量 2.Preference->Java->Installed JREs->Edit 选择一个jdk 3.添加 -Dmaven.multiModuleProjectDirectory=$M2_HOME 4. 神圣的一步:Finish

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

在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

cmd中创建虚拟环境,pycharm中使用虚拟环境

1.安装 virtualenvwrapper pip install virtualenvwrapper-win # windows pip install virtualenvwrapper # linux 2.创建虚拟环境 mkvirtualenv 虚拟环境名 #创建之后会自动进入虚拟环境 3.查看启用的虚拟环境    workon查看有哪些开启的虚拟环境,workon +虚拟环境名     进入虚拟环境 4.在pycharm中设置使用虚拟环境,在settings中配置,点击Add 5.路径

pycharm中的快捷键和简单设置

PyCharm3.0默认快捷键(翻译的) PyCharm Default Keymap 1.编辑(Editing) Ctrl + Space    基本的代码完成(类.方法.属性)Ctrl + Alt + Space  快速导入任意类Ctrl + Shift + Enter    语句完成Ctrl + P    参数信息(在方法中调用参数) Ctrl + Q    快速查看文档 F1   外部文档 Shift + F1    外部文档,进入web文档主页 Ctrl + Shift + Z -->

Pycharm中不支持中文编码的解决方案。Pycharm中文报错。 Pycharm出现的部分快捷键无效及解决办法

Pycharm中不支持中文编码的解决方案.Pycharm中文报错. 1. 打开Pycharm ---->  File ----> Default setting ------> Editor -------> File Encodings ,如下图,设置成UTF-8, 然后应用 2.  点击[File]---[Setting]---[Editor]---[File and Code Templates],点击右边的[python script],在编辑框中输入: #-*-codin