[英]Django Custom Commands don't work in Eclipse
I recently made some changes to my development environment and came across a problem. 最近,我对开发环境进行了一些更改,并遇到了一个问题。 I have a Django project in eclipse (using Pydev through the Aptana plugin), and I haven't been able to use any of my custom django commands. 我在eclipse中有一个Django项目(通过Aptana插件使用Pydev),但是我无法使用任何自定义django命令。
If I try to run a custom command, I get the following output: 如果尝试运行自定义命令,则会得到以下输出:
Unknown command: 'resetdb'
Type 'manage.py help' for usage.
...But if I run the command from the command line, it works. ...但是,如果我从命令行运行命令,它将起作用。
I've tried debugging, to see why the custom command doesn't run, and it looks like django can't find <project_name>.management
, but I'm not sure why this previously worked. 我尝试调试,以查看为什么自定义命令无法运行,并且django找不到<project_name>.management
,但是我不确定为什么以前可以运行。
Any ideas as to why I can't get custom commands working? 关于为什么我无法使自定义命令起作用的任何想法?
In case it's a problem with any of the software (and not my project), I have the following setup: 如果任何软件(而不是我的项目)有问题,我可以进行以下设置:
EDIT: 编辑:
Project structure is as follows: 项目结构如下:
Installed Apps: 已安装的应用程序:
INSTALLED_APPS = (
'Main', # Enables us to use custom commands
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
#... plus apps for the project
)
When you run your custom commands from Eclipse, make sure the correct settings.py file is being used to start the environment. 从Eclipse运行自定义命令时,请确保使用了正确的settings.py文件来启动环境。 If Eclipse is somehow invoking the command with a default settings.py that doesn't have your apps listed, this is the effect you would see. 如果Eclipse以某种方式使用未列出您的应用程序的默认settings.py调用该命令,则将产生效果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.