#24403 closed Bug (duplicate)
makemessages when run for a django app and no settings will fail on settings.STATIC_ROOT and settings.MEDIA_ROOT not being set
Reported by: | Carsten Klein | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.8alpha1 |
Severity: | Normal | Keywords: | |
Cc: | github.vibepy@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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
Change History (3)
comment:1 by , 10 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 10 years ago
Oh, great I did search for makemessages / django-admin but did not search for closed issues as well...
How about publishing a newer release on PyPi then?
Duplicate of #23717.
As you can see, your 1.8 version is several months old...