makemessages fails

90 views
Skip to first unread message

Yves de Champlain

unread,
Feb 12, 2020, 9:21:53 AM2/12/20
to Django users
Hi

When I run 

django-admin makemessages -l fr

I get 

Traceback (most recent call last):

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv

 
self.execute(*args, **cmd_options)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute

 output
= self.handle(*args, **options)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/commands/makemessages.py", line 353, in handle

 
if self.settings_available:

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__

 res
= instance.__dict__[self.name] = self.func(instance)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/commands/makemessages.py", line 413, in settings_available

 settings
.LOCALE_PATHS

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__

 
self._setup(name)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup

 
self._wrapped = Settings(settings_module)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/conf/__init__.py", line 157, in __init__

 mod
= importlib.import_module(self.SETTINGS_MODULE)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/importlib/__init__.py", line 127, in import_module

 
return _bootstrap._gcd_import(name[level:], package, level)

 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load

 
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked

 
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load

 
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked

 
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load

 
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'config'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

 
File "/opt/miniconda3/envs/cert_tool/bin/django-admin", line 10, in <module>

 sys
.exit(execute_from_command_line())

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line

 utility
.execute()

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute

 
self.fetch_command(subcommand).run_from_argv(self.argv)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/core/management/base.py", line 336, in run_from_argv

 connections
.close_all()

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/db/utils.py", line 219, in close_all

 
for alias in self:

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/db/utils.py", line 213, in __iter__

 
return iter(self.databases)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/utils/functional.py", line 80, in __get__

 res
= instance.__dict__[self.name] = self.func(instance)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/db/utils.py", line 147, in databases

 
self._databases = settings.DATABASES

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/conf/__init__.py", line 79, in __getattr__

 
self._setup(name)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/conf/__init__.py", line 66, in _setup

 
self._wrapped = Settings(settings_module)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/site-packages/django/conf/__init__.py", line 157, in __init__

 mod
= importlib.import_module(self.SETTINGS_MODULE)

 
File "/opt/miniconda3/envs/cert_tool/lib/python3.7/importlib/__init__.py", line 127, in import_module

 
return _bootstrap._gcd_import(name[level:], package, level)

 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load

 
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked

 
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load

 
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked

 
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load

 
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'config'

"config" is the name of the root-level folder where my settings are.

Everything works OK : makemigrations, migrate, --version, help, runserver, ... all except compilemessages that generates the same error.

Django 2.2.8


Thanks for any hint !

Yash Garg

unread,
Feb 12, 2020, 12:53:06 PM2/12/20
to Django users
Have you specified path to Locale directory in settings.py?

Yves de Champlain

unread,
Feb 12, 2020, 11:54:59 PM2/12/20
to Django users
Hi

I have

ROOT_DIR = environ.Path(__file__) - 3  # (base_dir/config/settings/common.py - 3 = base_dir/)
PROJ_DIR = ROOT_DIR

LOCALE_PATHS = [
    PROJ_DIR('locale'),
]

Could it be the source of the problem ?

Thanks !

Yash Garg

unread,
Feb 13, 2020, 12:20:54 AM2/13/20
to django...@googlegroups.com
Go through i18n official documentation and specify path according to that.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/23b814b4-c07f-4af0-9cf9-3a3c4e9b3906%40googlegroups.com.

maninder singh Kumar

unread,
Feb 13, 2020, 8:02:41 AM2/13/20
to django...@googlegroups.com
Is the app installed in settings.py

Sent from my iPad

Yves de Champlain

unread,
Feb 13, 2020, 8:39:47 AM2/13/20
to Django users
Actually, while 

django-admin makemessages -l fr

fails, 

python manage.py makemessages -l fr

works well, so the problem really is the custom 

/config/settings/common.py

settings file that need the DJANGO_SETTINGS_MODULE environment variable included in manage,py.

Thanks for your help !

yves


To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages