Pycharm错误:配置不正确 [英] Pycharm error: Improperly configured

查看:3157
本文介绍了Pycharm错误:配置不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的DEV机器意外关机之后,当回到Pycharm项目时,我注意到我正在编辑的Django视图文件(它有700多行),当它发生时,它完全是空的。我设法从备份恢复它;



尝试调试时出现问题,它返回此错误:正确配置:请求的设置DEFAULT_INDEX_TABLESPACE,但设置未配置,您必须定义环境变量DJANGO_SETTINGS_MODULE或在设置前调用settings.configure()。进程完成退出代码137



Pycharm设置Django支持(项目根,设置和管理脚本)也具有预期的值。



如果我使用./manage .py runserver命令运行项目,一切都很好。我甚至可以使用manage.py dbshel​​l访问数据库。我看着我的设置文件,一切似乎都可以。我也从3.0.1更新到3.1.1,没有区别。



我使用的是Django 1.6.1和postgresql 9.2.7。我可以做什么?

解决方案

对于Pycharm,只需去运行 - >编辑配置,选择你的项目右边的窗口从Debug Configuration,您将看到右侧的Environment变量。确保你已经设置了DJANGO_SETTINGS_MODULE = mysite.settings,如果不只是添加一个,那么从弹出的对话框中填入一个键值对一样简单。


After having an unexpected shutdown on my DEV machine, when going back to Pycharm project, I noticed the Django view file I was editing (which had 700+ lines) when that happened, it was completely empty. I managed to restore it from a backup; no loss there.

The problem comes up when trying to debug, it returns this error: "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." Process finished with exit code 137

The Pycharm settings Django Support (project root, settings & manage script) have the expected values as well.

If I run the project with the ./manage .py runserver command, everything is fine. I can even access the DB with manage.py dbshell. I looked at my settings file and everything seems OK. I also updated from version 3.0.1 to 3.1.1, and no difference.

I'm using Django 1.6.1 and postgresql 9.2.7. What can I do?

解决方案

For Pycharm, just go to Run -> Edit Configurations, select your project on the right of the window from Debug Configuration, and you will see Environment variables on the right. Make sure you have set DJANGO_SETTINGS_MODULE=mysite.settings, if not just add one, it is as easy as fill a key value pair from the pop up dialog.

这篇关于Pycharm错误:配置不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆