Ellis Percival
Ellis Percival

Reputation: 5022

django-admin.py doesn't find management commands but manage.py does

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

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

Upvotes: 0

Views: 2633

Answers (2)

Ellis Percival
Ellis Percival

Reputation: 5022

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.

Upvotes: 0

finiteautomata
finiteautomata

Reputation: 3813

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/

Upvotes: 2

Related Questions