Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any purposes for the management folder in Django other than commands?

Why are management commands not in their own app-level folder? Are there other items which can be added to the management directory or is this structure purely vestigial?

like image 695
spulec Avatar asked Apr 29 '11 18:04

spulec


People also ask

What is the use of manage py in Django?

In addition, manage.py is automatically created in each Django project. It does the same thing as django-admin but also sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project's settings.py file.


2 Answers

I don't know the history, but it seems semi-vestigial to me. As for other stuff that can be put in the management dir, the comment about signals above hints at one answer.

One thing I do when trying to answer such questions is to look at the contrib apps to see what they do. Some interesting bits to be found:

  • auth/management/__init__.py
  • sites/management.py

Note that in the second one, the management module is a .py file rather than a directory.

like image 104
Paul Bissex Avatar answered Oct 06 '22 08:10

Paul Bissex


Another thing that needs to be placed in the management module (either in management/__init__.py or management.py) is any listeners to the django.db.models.signals.post_sync signal.

like image 45
Jakub Roztocil Avatar answered Oct 06 '22 09:10

Jakub Roztocil