Question

I have a Django project with management commands in called "listen_rfid" and "listen_qr". They both show up in

./manage.py help --settings=imagination.idmapper.config.settings_dev

but neither show up in

django-admin.py help --settings=imagination.idmapper.config.settings_dev
  • I have diffed the output of diffsettings from django-admin.py and manage.py and there are no differences.
  • My apps are correctly listed in INSTALLED_APPS.
  • DJANGO_SETTINGS_MODULE is set the same in my environment and in manage.py.
  • I am able to import my management commands as a python module and run them from the django-admin.py shell.
  • I'm working in a virtualenv, but the django-admin.py command is the one installed within it, as evidenced by 'which django-admin.py'.

What could be any possible reasons for django-admin.py acting differently to manage.py?

I'm using Django 1.5.5 on Ubuntu 12.04

Was it helpful?

Solution 2

Finally found the answer to this question! Here's a quote from the django bug report:

django.core.management.find_management_module() loads custom commands for manage.py by finding the path of the module and examining file directly. This fails when apps are within packages that share a common base name, but where the files are NOT in the same directories, example:

  • app 1: company.division.project_a.app1 stored in path packages/company.subdivision.project_a.app1
  • app 2: company.division.project_b.app2 stored in path packages/company.subdivision.project_b.app2

Custom commands in app 2 will not be found.

OTHER TIPS

According to documentation

django-admin.py is Django’s command-line utility for administrative tasks. This document outlines all it can do.

In addition, manage.py is automatically created in each Django project. manage.py is a thin wrapper around django-admin.py that takes care of two things for you before delegating to django-admin.py:

1) It puts your project’s package on sys.path. 2) It sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s settings.py file. 3) It calls django.setup() to initialize various internals of Django.

There could be possibly a problem with point 1 or 3. By the ways, I've always used ./manage.py with no problem at all in django 1.5

https://docs.djangoproject.com/en/dev/ref/django-admin/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top