Reputation: 716
I'm trying to add a translation (localization) layer to my appliaction. I have tried to follow the instructions from: https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#how-to-create-language-files
But I run in some problems when I tried to run
django-admin.py makemessages -l he
In order to create a translation file for Hebrew.
When I first run this code I got the following error:
CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
So I run the command:
brew install gettext
But I still got an error:
CommandError: Can't find msguniq. Make sure you have GNU gettext tools 0.15 or newer installed.
So I saw in some places that I need to run:
brew link gettext --force
Now when I try to run the command:
django-admin.py makemessages -l he
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
pkg_resources.run_script('Django==1.7.1', 'django-admin.py')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 492, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1350, in run_script
execfile(script_filename, namespace, namespace)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/EGG-INFO/scripts/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/base.py", line 533, in handle
return self.handle_noargs(**options)
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/commands/makemessages.py", line 283, in handle_noargs
potfiles = self.build_potfiles()
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/commands/makemessages.py", line 299, in build_potfiles
file_list = self.find_files(".")
File "/Library/Python/2.7/site-packages/Django-1.7.1-py2.7.egg/django/core/management/commands/makemessages.py", line 358, in find_files
ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT)]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 327, in normpath
initial_slashes = path.startswith('/')
AttributeError: 'NoneType' object has no attribute 'starts with'
I'm using a Mac with Django 1.7 and Python 2.7.6
please help to understand what I'm missing
Upvotes: 0
Views: 3427
Reputation: 98
try for instance python ../manage.py makemessages -l en
inside your app
django-admin.py
didn't work for me either
Upvotes: 1
Reputation: 12110
You should point django to your project's settings.py
file.
export DJANGO_SETTINGS_MODULE=/path/to/settings.py
Upvotes: 1