Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22942 closed Cleanup/optimization (fixed)

Custom django-admin commands - __init__.py in directories

Reported by: Diego Cerdán <diegocerdan@…> 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 Tim Graham, 10 years ago

The first example includes both __init__.py files. Does it really need special emphasis?

comment:2 by Aymeric Augustin, 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 Tim Graham, 10 years ago

Resolution: worksforme
Status: newclosed

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 Tim Graham, 10 years ago

Resolution: worksforme
Status: closednew

Reported again in #22974 so I'm going to add some emphasis about this.

comment:5 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 54546cee88f1db4e7e0ad75ebb9672c118b2236c:

Fixed #22942 -- Noted that init.py files are required for management command detection.

Thanks Diego Cerdán for the suggestion.

comment:6 by Tim Graham <timograham@…>, 10 years ago

In 837cad0f6242f5292b8a4811fc48fbfbefe92a47:

[1.6.x] Fixed #22942 -- Noted that init.py files are required for management command detection.

Thanks Diego Cerdán for the suggestion.

Backport of 54546cee88 from master

comment:7 by Tim Graham <timograham@…>, 10 years ago

In c379fc4eec885101ac30e0505f967048c869e630:

[1.7.x] Fixed #22942 -- Noted that init.py files are required for management command detection.

Thanks Diego Cerdán for the suggestion.

Backport of 54546cee88 from master

Note: See TracTickets for help on using tickets.
Back to Top