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?
相关问题
- Django __str__ returned non-string (type NoneType)
- Django & Amazon SES SMTP. Cannot send email
- Django check user group permissions
- Django restrict pages to certain users
- UnicodeEncodeError with attach_file on EmailMessag
相关文章
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- Django is sooo slow? errno 32 broken pipe? dcramer
- Django: Replacement for the default ManyToMany Wid
- Upgrading transaction.commit_manually() to Django
- UnicodeEncodeError when saving ImageField containi
Another thing that needs to be placed in the
management
module (either inmanagement/__init__.py
ormanagement.py
) is any listeners to thedjango.db.models.signals.post_sync
signal.It is a skeleton of django's general design. Almost every project will contain multiple apps, so the project is really a container of apps with a shared configuration.
You can add other items to the project level folder, but the design suggests only high level cross-app items should be. Examples are urls and settings.
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.