Opened 7 years ago
Closed 7 years ago
#28524 closed Cleanup/optimization (fixed)
Improve program name for Django's command-line utility.
Reported by: | Nick Pope | Owned by: | Nick Pope |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Normal | Keywords: | command-line |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
By default, according to the documentation there are three ways to execute Django's command-line utility:
$ django-admin <command> [options] $ manage.py <command> [options] $ python -m django <command> [options]
When executing the help
command, however, the way these are rendered may be incorrect:
$ django-admin help Type 'django-admin help <subcommand>' for help on a specific subcommand. ...
$ ./manage.py help Type 'manage.py help <subcommand>' for help on a specific subcommand. ...
$ python -m django help Type '__main__.py help <subcommand>' for help on a specific subcommand. ...
It should also be noted that manage.py
will typically not work and ./manage.py
is required:
$ manage.py help bash: manage.py: command not found
On Windows it will work, but only if the file type is associated with the Python interpreter and not an editor.
So, the issues here are:
__main__.py
should be replaced bypython -m django
(or possibly useos.path.basename(sys.executable)
)- Should
manage.py
be replaced with./manage.py
on non-Windows platforms? What about Windows? - What should happen with the
manage.py
option in the documentation?
Change History (6)
comment:1 by , 7 years ago
Has patch: | set |
---|
comment:2 by , 7 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 7 years ago
Needs tests: | unset |
---|
Thanks Simon. Test added similar to existing one for manage.py
; original commit referenced.
There probably ought to be a test for the program name in the help output for django-admin
also, but the test suite executes it from the file path directly resulting in django-admin.py
rather than the documented django-admin
... Not really sure how to get around that.
What are your thoughts with respect to the other points in this ticket about manage.py
?
comment:5 by , 7 years ago
What are your thoughts with respect to the other points in this ticket about manage.py?
About 2. I think it should stay the way it is because while it's invoked as ./manage.py
most of the time I've seen python manage.py
being used as well.
Might want to ref #24857 in the commit message.