I have a django instance packed in Docker container in docker-compose.
I'm trying to generate makemessages files for project, but when I try to run makemessages, that's what I receieve in response
root@6fc510c9c5d1:/code# python manage.py makemessages
/usr/local/lib/python3.6/dist-packages/daphne/server.py:12: UserWarning: Something has already installed a non-asyncio Twisted reactor. Attempting to uninstall it; you can fix this warning by importing daphne.server early in your codebase or finding the package that imports Twisted and importing it later on.
UserWarning,
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 347, in execute
django.setup()
File "/usr/local/lib/python3.6/dist-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.6/dist-packages/django/apps/registry.py", line 112, in populate
app_config.import_models()
File "/usr/local/lib/python3.6/dist-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/models.py", line 94, in <module>
class Group(models.Model):
File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 152, in __new__
new_class.add_to_class(obj_name, obj)
File "/usr/local/lib/python3.6/dist-packages/django/db/models/base.py", line 315, in add_to_class
value.contribute_to_class(cls, name)
File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related.py", line 1586, in contribute_to_class
self.remote_field.through = create_many_to_many_intermediary_model(self, cls)
File "/usr/local/lib/python3.6/dist-packages/django/db/models/fields/related.py", line 1051, in create_many_to_many_intermediary_model
'verbose_name': _('%(from)s-%(to)s relationship') % {'from': from_, 'to': to},
File "/usr/local/lib/python3.6/dist-packages/django/utils/functional.py", line 148, in __mod__
return str(self) % rhs
File "/usr/local/lib/python3.6/dist-packages/django/utils/functional.py", line 112, in __text_cast
return func(*self.__args, **self.__kw)
File "/usr/local/lib/python3.6/dist-packages/django/utils/translation/__init__.py", line 77, in gettext
return _trans.gettext(message)
File "/usr/local/lib/python3.6/dist-packages/django/utils/translation/trans_real.py", line 312, in gettext
_default = _default or translation(settings.LANGUAGE_CODE)
File "/usr/local/lib/python3.6/dist-packages/django/utils/translation/trans_real.py", line 221, in translation
_translations[language] = DjangoTranslation(language)
File "/usr/local/lib/python3.6/dist-packages/django/utils/translation/trans_real.py", line 122, in __init__
self._add_installed_apps_translations()
File "/usr/local/lib/python3.6/dist-packages/django/utils/translation/trans_real.py", line 170, in _add_installed_apps_translations
translation = self._new_gnu_trans(localedir)
File "/usr/local/lib/python3.6/dist-packages/django/utils/translation/trans_real.py", line 149, in _new_gnu_trans
fallback=use_null_fallback)
File "/usr/lib/python3.6/gettext.py", line 538, in translation
t = _translations.setdefault(key, class_(fp))
File "/usr/lib/python3.6/gettext.py", line 254, in __init__
self._parse(fp)
File "/usr/lib/python3.6/gettext.py", line 345, in _parse
magic = unpack('<I', buf[:4])[0]
struct.error: unpack requires a buffer of 4 bytes
Do you have any ideas what it can be?
It might be raised by your .mo file(s). Please check if this file is empty. If this is indeed the case. Remove your .mo file and rerun the
makemessagescommand.It should solve the issue you're having.
If this doesn't solve your issue. Try this: