[Django] #26940: django-admin makemessages vs. manage.py makemessages

48 views
Skip to first unread message

Django

unread,
Jul 22, 2016, 10:25:07 PM7/22/16
to django-...@googlegroups.com
#26940: django-admin makemessages vs. manage.py makemessages
--------------------------------------+--------------------------
Reporter: romeroqj | Owner: nobody
Type: Uncategorized | Status: new
Component: Internationalization | Version: 1.9
Severity: Normal | Keywords: translations
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------------
'''django-admin''' and '''manage.py''' are supposed to be interchangeable.

From the docs(https://docs.djangoproject.com/en/1.9/ref/django-admin/):

''The command-line examples throughout this document use django-admin to
be consistent, but any example can use manage.py or python -m django just
as well.''

However, this doesn't seem to be true for ''makemessages''.

If I run ''manage.py makemessages'' from the top level of the project
MEDIA_ROOT and STATIC_ROOT are ignored. This isn't precisely a bug because
that's what the code is intended to do
(https://github.com/django/django/blob/master/django/core/management/commands/makemessages.py#L448),
but I find it strange specially for ''--domain djangojs'' because is very
common for Javascript files to be put in STATIC_ROOT.

django-admin makemessages doesn't ignore MEDIA_ROOT or STATIC_ROOT and it
traverses the entire source tree.

At least this should be explained in the documentation. At best both
commands should do the exact same. It's very easy to be bitten by this as
we don't always review the resulting *.po file.

Am I missing something here?

--
Ticket URL: <https://code.djangoproject.com/ticket/26940>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 23, 2016, 12:09:27 AM7/23/16
to django-...@googlegroups.com
#26940: django-admin makemessages vs. manage.py makemessages
-------------------------------------+-------------------------------------

Reporter: romeroqj | Owner: nobody
Type: Uncategorized | Status: new
Component: | Version: 1.9
Internationalization |
Severity: Normal | Resolution:

Keywords: translations | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Maybe the documentation should mention that `--settings` must be specified
to `django-admin` and `python -m django` for them to be interchangeable
with `manage.py`.

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:1>

Django

unread,
Jul 23, 2016, 6:44:49 AM7/23/16
to django-...@googlegroups.com
#26940: django-admin makemessages vs. manage.py makemessages
--------------------------------------+------------------------------------
Reporter: romeroqj | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: 1.9
Severity: Normal | Resolution:
Keywords: translations | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

Currently, `makemessages` is explicitly whitelisted as not needing a
configured settings file (see `no_settings_commands` in
`django.core.management.__init__.py`.
I wonder now if we should revert that, considering the dependency of that
command on `settings.FILE_CHARSET`, `settings.LOCALE_PATHS`,
`settings.MEDIA_ROOT`, and `settings.STATIC_ROOT`.

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:2>

Django

unread,
Aug 7, 2016, 2:11:32 PM8/7/16
to django-...@googlegroups.com
#26940: django-admin makemessages vs. manage.py makemessages
--------------------------------------+------------------------------------
Reporter: romeroqj | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: master

Severity: Normal | Resolution:
Keywords: translations | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by claudep):

* has_patch: 0 => 1
* version: 1.9 => master


Comment:

[https://github.com/django/django/pull/7040 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:3>

Django

unread,
Aug 8, 2016, 1:06:43 PM8/8/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: romeroqj | Owner: nobody
Type: Bug | Status: new
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: translations | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:4>

Django

unread,
Aug 8, 2016, 1:53:58 PM8/8/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: romeroqj | Owner: nobody
Type: Bug | Status: closed
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed

Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a6baada7bdf0c2b14045ee86364f9401c7b91b7c" a6baada7]:
{{{
#!CommitTicketReference repository=""
revision="a6baada7bdf0c2b14045ee86364f9401c7b91b7c"
Fixed #26940 -- Removed makemessages from no_settings_commands whitelist

As makemessages uses several settings for proper run (FILE_CHARSET,
LOCALE_PATHS, MEDIA_ROOT, and STATIC_ROOT), we should require settings
configuration for this command.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:5>

Django

unread,
Sep 29, 2016, 4:38:44 PM9/29/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: new

Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: translations | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* status: closed => new
* resolution: fixed =>
* stage: Ready for checkin => Unreviewed


Comment:

I'm considering reverting the fact that we require configured settings for
makemessages.
I'm thinking about the use case of reusable apps, when you typically don't
have/need STATIC_ROOT/MEDIA_ROOT/LOCALE_PATHS, and most of the time
FILE_CHARSET in utf-8 is fine.
See
[https://github.com/django/django/commit/c0ad0ede253e7fb590acf1eec58f04380f742e3a
this commit], above [https://github.com/django/django/pull/7315 that PR].

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:6>

Django

unread,
Sep 30, 2016, 11:32:44 AM9/30/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: new
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: translations | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz):

Here's the [https://github.com/django/django/pull/7328 PR].

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:7>

Django

unread,
Sep 30, 2016, 12:38:50 PM9/30/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: new
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: translations | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:8>

Django

unread,
Oct 1, 2016, 9:01:54 AM10/1/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: new
Component: | Version: master
Internationalization |
Severity: Normal | Resolution:
Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"fa2f55cfd554c6f99653ffe0d40fd7ca74cb680e" fa2f55c]:
{{{
#!CommitTicketReference repository=""
revision="fa2f55cfd554c6f99653ffe0d40fd7ca74cb680e"
Refs #26940 -- Re-allowed makemessages without settings

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:9>

Django

unread,
Oct 1, 2016, 9:03:36 AM10/1/16
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: closed
Component: | Version: master
Internationalization |
Severity: Normal | Resolution: fixed

Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* status: new => closed
* resolution: => fixed


--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:10>

Django

unread,
May 6, 2025, 1:12:42 PM5/6/25
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: closed
Component: | Version: dev
Internationalization |
Severity: Normal | Resolution: fixed
Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* cc: Claude Paroz (added)

Comment:

There seems to be a potential regression about this in current `main` (6.0
development cycle). When running:
{{{
$ django-admin --version
6.0.dev20250506141140
}}}
{{{
$ django-admin makemessages --all -v 2
Traceback (most recent call last):
File "/home/nessita/.venvs/djangodev-3.13/bin/django-admin", line 8, in
<module>
sys.exit(execute_from_command_line())
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File
"/home/nessita/fellowship/django/django/core/management/__init__.py", line
442, in execute_from_command_line
utility.execute()
~~~~~~~~~~~~~~~^^
File
"/home/nessita/fellowship/django/django/core/management/__init__.py", line
436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File "/home/nessita/fellowship/django/django/core/management/base.py",
line 416, in run_from_argv
self.execute(*args, **cmd_options)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/nessita/fellowship/django/django/core/management/base.py",
line 460, in execute
output = self.handle(*args, **options)
File
"/home/nessita/fellowship/django/django/core/management/commands/makemessages.py",
line 372, in handle
% get_text_list(list(self.extensions), "and")
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/nessita/fellowship/django/django/utils/functional.py", line
231, in wrapper
return func(*args, **kwargs)
File "/home/nessita/fellowship/django/django/utils/text.py", line 306,
in get_text_list
_(", ").join(str(i) for i in list_[:-1]),
~^^^^^^
File
"/home/nessita/fellowship/django/django/utils/translation/__init__.py",
line 96, in gettext
return _trans.gettext(message)
^^^^^^^^^^^^^^
File
"/home/nessita/fellowship/django/django/utils/translation/__init__.py",
line 66, in __getattr__
if settings.USE_I18N:
^^^^^^^^^^^^^^^^^
File "/home/nessita/fellowship/django/django/conf/__init__.py", line 75,
in __getattr__
self._setup(name)
~~~~~~~~~~~^^^^^^
File "/home/nessita/fellowship/django/django/conf/__init__.py", line 55,
in _setup
raise ImproperlyConfigured(
...<4 lines>...
)
django.core.exceptions.ImproperlyConfigured: Requested setting USE_I18N,
but settings are not configured. You must either define the environment
variable DJANGO_SETTINGS_MODULE or call settings.configure() before
accessing settings.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:11>

Django

unread,
May 7, 2025, 3:18:44 AM5/7/25
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: closed
Component: | Version: dev
Internationalization |
Severity: Normal | Resolution: fixed
Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Claude Paroz):

Thanks for noticing, we should probably deactivate translations around the
call to `get_text_list`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:12>

Django

unread,
Nov 3, 2025, 9:23:00 AM11/3/25
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: closed
Component: | Version: dev
Internationalization |
Severity: Normal | Resolution: fixed
Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* cc: ontowhee (added)

Comment:

I added Lilian as cc. Lilian, do you think this small action item from the
last two commetns may pair up well with the other work that is being done
with translations in the context of Djangonaut Space?
--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:13>

Django

unread,
Nov 3, 2025, 10:11:15 AM11/3/25
to django-...@googlegroups.com
#26940: makemessages incorrectly configured as not requiring settings
-------------------------------------+-------------------------------------
Reporter: Jorge Romero | Owner: nobody
Type: Bug | Status: closed
Component: | Version: dev
Internationalization |
Severity: Normal | Resolution: fixed
Keywords: translations | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by ontowhee):

Replying to [comment:13 Natalia Bidart]:
> I added Lilian as cc. Lilian, do you think this small action item from
the last two commetns may pair up well with the other work that is being
done with translations in the context of Djangonaut Space?

Thanks for bringing this to my attention! This would pair well, and I can
share this ticket with the Djangonauts.
--
Ticket URL: <https://code.djangoproject.com/ticket/26940#comment:14>
Reply all
Reply to author
Forward
0 new messages