#22942 closed Cleanup/optimization (fixed)
Custom django-admin commands - __init__.py in directories
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Documentation should state that the file init.py is required in the management and commands directories.
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
Some people (included me) got confused but luckly is solved in this Stackoverflow question:
http://stackoverflow.com/questions/17962454/how-to-write-custom-django-manage-py-commands-in-multiple-apps
Change History (7)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
I don't believe these files are required on Python 3. (It may remain a good idea to include them.)
comment:3 by , 10 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Confirmed they are not required on Python 3.
On Python 2, the error is ImportError: No module named management.commands.mycommand
. I think that's a fairly intuitive message to indicate that the modules aren't properly configured.
comment:4 by , 10 years ago
Resolution: | worksforme |
---|---|
Status: | closed → new |
Reported again in #22974 so I'm going to add some emphasis about this.
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The first example includes both
__init__.py
files. Does it really need special emphasis?