关闭

pycharm 中的 Requested setting CACHES, but settings are not configured.

814人阅读 评论(0) 收藏 举报
分类:

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

昨天遇到一个问题,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 。

0
0
查看评论

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

django代码下面直接run的时候报错: django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You m...
  • heybob
  • heybob
  • 2015-11-06 16:05
  • 8439

django报错:django.core.exceptions.ImproperlyConfigured: 处理办法

django报错: Eclipse pydev 运行不出错,cmd 命令行界面中python 运行出错: django.core.exceptions.ImproperlyConfigured:  Requested setting&...
  • angel20082008
  • angel20082008
  • 2014-05-20 19:40
  • 29111

django.core.exceptions.ImproperlyConfigured: Requested setting TEMPLATE_DEBUG, but settings are not解

Traceback (most recent call last):   File "", line 1, in   File "D:\Python26\lib\site-packages\django\template\base.py&quo...
  • linux_ja
  • linux_ja
  • 2014-09-20 21:43
  • 1493

PyCharm开发django配置过程遇到问题(转)

使用PyCharm开发django程序,发现如果不在命令行而在IDE的django项目中直接运行django程序,发现报错,程序如下: def main(): from people.models import Blog blog = Blog() blog.name = ...
  • u011013781
  • u011013781
  • 2016-08-08 21:20
  • 7885

Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured

用python3.4作单元测试的时候,遇到了Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured。 网上查找的几种解决办法都不行,最终在PyCharm的单元测试配置中设置 DJANGO_SETTING...
  • Dawn_Bells
  • Dawn_Bells
  • 2017-09-11 17:57
  • 327

Gradle settings for this project are not configured yet

Android Studio and PhoneGap, Module android is not backed by gradle将Eclipse代码导入到AndroidStudio的两种方式问题:这个问题也可以描述为,解决gradle构建的eclipse项目导入到AS中出现的错误我遇到这个问题...
  • xx326664162
  • xx326664162
  • 2016-06-30 17:00
  • 7419

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 the environment variable DJANGO_SETTINGS_MODULE...
  • xiaowanggedege
  • xiaowanggedege
  • 2013-03-16 22:42
  • 9494

[Django]引入模版之后报错Requested setting TEMPLATE_DEBUG, but settings are not configured.

今天正在试图敲写以下代码: >>> from django import template >>> t = template.Template('My name is {{ name }}.') >>> c = temp...
  • wxg694175346
  • wxg694175346
  • 2013-05-08 09:24
  • 4782

Pycharm代码提示更新问题

使用Pycharm调用当前目录的别的文件,import时代码提示一直报无法解析(can not resolved xxx)错误,但是程序可以正常运行。处女座属性爆发,虽然可以用,但看着不爽,就可怜兮兮地找解决方案,说先在setting里工程设置里将当前文件夹加入到source root中,只解决了一...
  • hfut_jf
  • hfut_jf
  • 2016-11-01 09:02
  • 1567

Python [解决方法] error: Requested setting INSTALLED_APPS, but settings are not configured

今天在学习Django库在创建项目的时候:django-admin.py startproject [项目名称]报错error: Requested setting INSTALLED_APPS, but settings are not configured. You must either de...
  • zjiang1994
  • zjiang1994
  • 2016-09-27 14:57
  • 2490
    个人资料
    • 访问:10582次
    • 积分:257
    • 等级:
    • 排名:千里之外
    • 原创:14篇
    • 转载:1篇
    • 译文:0篇
    • 评论:3条
    文章分类
    最新评论