[Django] #24403: makemessages when run for a django app and no settings will fail on settings.STATIC_ROOT and settings.MEDIA_ROOT not being set

4 views
Skip to first unread message

Django

unread,
Feb 24, 2015, 5:17:25 AM2/24/15
to django-...@googlegroups.com
#24403: makemessages when run for a django app and no settings will fail on
settings.STATIC_ROOT and settings.MEDIA_ROOT not being set
--------------------------------------------+-----------------------
Reporter: silkentrance | Owner: nobody
Type: Bug | Status: new
Component: Core (Management commands) | Version: 1.8alpha1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+-----------------------
In management/commands/makemessages.py it reads in line 375

{{{
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT,
settings.STATIC_ROOT)]
}}}

This will fail in situations where there is no STATIC_ROOT a/o MEDIA_ROOT,
in which case ignored_roots will be populated with None, causing the
subsequent path operation os.normpath(p) to fail.

This in turn will prevent users from generating the po files for django
apps that do not have any such settings.

In order to fix this, the following code seems to work quite well

{{{
375 ignored_roots = []
376 if settings.MEDIA_ROOT:
377 ignored_roots.extend([os.path.normpath(p) for p in
settings.MEDIA_ROOT])
378 if settings.STATIC_ROOT:
379 ignored_roots.extend([os.path.normpath(p) for p in
settings.STATIC_ROOT])
}}}


----

I am using Django 1.8 installed via PyPi

{{{
# pip2 show django
---
Name: Django
Version: 1.8.dev20141027110112
}}}

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

Django

unread,
Feb 24, 2015, 5:49:54 AM2/24/15
to django-...@googlegroups.com
#24403: makemessages when run for a django app and no settings will fail on
settings.STATIC_ROOT and settings.MEDIA_ROOT not being set
-------------------------------------+-------------------------------------
Reporter: silkentrance | Owner: nobody
Type: Bug | Status: closed
Component: Core (Management | Version: 1.8alpha1
commands) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* status: new => closed
* needs_docs: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

Duplicate of #23717.
As you can see, your 1.8 version is several months old...

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

Django

unread,
Feb 25, 2015, 7:12:37 AM2/25/15
to django-...@googlegroups.com
#24403: makemessages when run for a django app and no settings will fail on
settings.STATIC_ROOT and settings.MEDIA_ROOT not being set
-------------------------------------+-------------------------------------
Reporter: silkentrance | Owner: nobody

Type: Bug | Status: closed
Component: Core (Management | Version: 1.8alpha1
commands) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed

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

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

Comment (by silkentrance):

Oh, great I did search for makemessages / django-admin but did not search
for closed issues as well...

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

Django

unread,
Feb 25, 2015, 11:03:21 AM2/25/15
to django-...@googlegroups.com
#24403: makemessages when run for a django app and no settings will fail on
settings.STATIC_ROOT and settings.MEDIA_ROOT not being set
-------------------------------------+-------------------------------------
Reporter: silkentrance | Owner: nobody

Type: Bug | Status: closed
Component: Core (Management | Version: 1.8alpha1
commands) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed

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

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

Comment (by claudep):

You will get a new release with `pip install --pre ...`

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

Reply all
Reply to author
Forward
0 new messages