Hi guys I have been trying to find a reason for the existence of the _private.py
file when you are declaring custom management commands. I tried to look on many pages and forums and I did not find anything relevant.
The most explicit documentation about this file that I found, is on the official documentation which states the following:
The
_private.py
module will not be available as a management command.
However that really does not give us so much information about what is the purpose of that file, or why would I really need to declare that, does any one of you guys know?
The name _private.py
isn't a special, but its leading underscore is (from the link in your question, bold added):
To do this, add a
management/commands
directory to the application. Django will register amanage.py
command for each Python module in that directory whose name doesn’t begin with an underscore.
As to why you'd want a file there that doesn't get registered as a command, maybe you want to factor out some behaviour and use it in two modules that do get registered as commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With