{{{#!sh
$ 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:
{{{#!console
$ django-admin help
Type 'django-admin help <subcommand>' for help on a specific subcommand.
...
}}}
{{{#!console
$ ./manage.py help
Type 'manage.py help <subcommand>' for help on a specific subcommand.
...
}}}
{{{#!console
$ 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:
{{{#!console
$ 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:
1. `__main__.py` should be replaced by `python -m django` (or possibly use
`os.path.basename(sys.executable)`)
2. Should `manage.py` be replaced with `./manage.py` on non-Windows
platforms? What about Windows?
3. What should happen with the `manage.py` option in the documentation?
--
Ticket URL: <https://code.djangoproject.com/ticket/28524>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/28524#comment:1>
* stage: Unreviewed => Accepted
Comment:
Might want to ref #24857 in the commit message.
--
Ticket URL: <https://code.djangoproject.com/ticket/28524#comment:2>
* needs_tests: 0 => 1
Comment:
[https://github.com/django/django/pull/8961 PR] missing tests.
--
Ticket URL: <https://code.djangoproject.com/ticket/28524#comment:3>
* needs_tests: 1 => 0
Comment:
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`?
--
Ticket URL: <https://code.djangoproject.com/ticket/28524#comment:4>
Comment (by Simon Charette):
> 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.
--
Ticket URL: <https://code.djangoproject.com/ticket/28524#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ec6481246a76f6a3339c987f14c3878f55cd7300" ec648124]:
{{{
#!CommitTicketReference repository=""
revision="ec6481246a76f6a3339c987f14c3878f55cd7300"
Fixed #28524 -- Fixed program name in management commands when using
'python -m django'.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28524#comment:6>