I always use this script to compile django.po and it was always working:
#!/bin/sh
django-admin.py makemessages -a
django-admin.py compilemessages
Suddenly it stopped working, with this error:
$ i18n.sh
Traceback (most recent call last):
File "c:/Python34/Scripts/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line
385, in execute_from_command_line
utility.execute()
File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line
377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\Python34\lib\site-packages\django\core\management\base.py", line 288,
in run_from_argv
self.execute(*args, **options.__dict__)
File "c:\Python34\lib\site-packages\django\core\management\base.py", line 338,
in execute
output = self.handle(*args, **options)
File "c:\Python34\lib\site-packages\django\core\management\base.py", line 533,
in handle
return self.handle_noargs(**options)
File "c:\Python34\lib\site-packages\django\core\management\commands\makemessag
es.py", line 283, in handle_noargs
potfiles = self.build_potfiles()
File "c:\Python34\lib\site-packages\django\core\management\commands\makemessag
es.py", line 299, in build_potfiles
file_list = self.find_files(".")
File "c:\Python34\lib\site-packages\django\core\management\commands\makemessag
es.py", line 358, in find_files
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings
.STATIC_ROOT)]
File "c:\Python34\lib\site-packages\django\core\management\commands\makemessag
es.py", line 358, in <listcomp>
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings
.STATIC_ROOT)]
File "c:\Python34\lib\ntpath.py", line 491, in normpath
if path.startswith(special_prefixes):
AttributeError: 'NoneType' object has no attribute 'startswith'
processing file django.po in c:\Users\Debora\workspace\opti\opti2.0\project\loca
le\pt_BR\LC_MESSAGES
Anyone has got any ideas?
I don't know what caused this. recently I updated django 1.7 to 1.7.1, installed some packages unrelated, that's what I remember doing that could have affected.
Just set
STATIC_ROOT
in your settings.py file.This is a bug in Django 1.7.1 and should be removed in Django 1.7.2
(Since Django 1.6.2
STATIC_ROOT
defaults toNone
, before''
.)Problem is when You didn't setup your
STATIC_ROOT
andMEDIA_ROOT
settings value. After setting this like:I'm using
make_messages.sh
script:and after executing
make_messages.sh
:And this is my
compile_messages.sh
script:I had the same problems using Django 1.7.1.
I fixed it by changing the command:
django-admin.py
topython manage.py
.So my entire command goes like this:
python manage.py makemessages --locale=en --ignore=templates/admin --ignore=project/settings.py
first Define your local path for makemessages
In terminal
$python manage.py makemessages -l pl
go the folder and open the file edit the .po file
Then in terminal
$python manage.py compilemessages
it works fine in Django 1.7 and upgraded too.
i think it may help you.
I had the same ussue. I tried to run with django-admin, and got this issue.
When I run it with manage.py, it runs ok.
Use manage.py, manage_local.py is my alternated version.
Had the same issue after upgrading to Django 1.7
I fixed it by specifying the settings module each time I run
django-admin.py
:Update: It is a bug fixed in Django 1.7.2 see: https://docs.djangoproject.com/en/1.7/releases/1.7.2/ https://code.djangoproject.com/ticket/23717