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.
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.
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:
- Eclipse Galileo (3.5.2)
- Django 1.3
- Aptana Studio 3.0.6
- Python 2.6
- Ubuntu 10.10
EDIT:
Project structure is as follows:
- Project/
- src/
- Main/
- management/
- commands/
- custom_command.py
- commands/
- manage.py
- settings.py
- management/
- Main/
- src/
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. 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.