1

I was following Django tutorial and after this step I started having this error when I try to run the local server:

~/django-project/mysite $ python3 manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
July 30, 2015 - 17:30:01
Django version 1.8.3, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fe3e65b79d8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py", line 134, in inner_run
    translation.activate(settings.LANGUAGE_CODE)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/translation/__init__.py", line 146, in activate
    return _trans.activate(language)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/translation/trans_real.py", line 222, in activate
    _active.value = translation(language)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/translation/trans_real.py", line 206, in translation
    _translations[language] = DjangoTranslation(language)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/translation/trans_real.py", line 115, in __init__
    self._init_translation_catalog()
  File "/usr/local/lib/python3.4/dist-packages/django/utils/translation/trans_real.py", line 153, in _init_translation_catalog
    translation = self._new_gnu_trans(localedir, use_null_fallback)
  File "/usr/local/lib/python3.4/dist-packages/django/utils/translation/trans_real.py", line 136, in _new_gnu_trans
    fallback=use_null_fallback)
  File "/usr/lib/python3.4/gettext.py", line 416, in translation
    raise OSError(ENOENT, 'No translation file found for domain', domain)
FileNotFoundError: [Errno 2] No translation file found for domain: 'django'

I looked over the internet but couldn't find a proper solution.

All I did was to create the folders and edit the files as explained on the tutorial, I couldn't see any relations with translation.

I tried to undo the changes that I made on the last step but got the same error again.

Thanks in advance,

Cagri

Cagri Sarigoz
  • 366
  • 3
  • 7
  • http://stackoverflow.com/questions/3837683/python-no-translation-file-found-for-domain-using-custom-locale-folder – chandu Jul 31 '15 at 14:08
  • @chandu I've seen that threat but couldn't figure out how to use in my case. the `__init__.py` file is different. – Cagri Sarigoz Jul 31 '15 at 16:35
  • I've turned translation off by changing `USE_I18N` value to `False` in `settings.py` file of my project. I guess it's not a good way to solve the problem but gets me back on track on the tutorial anyway. – Cagri Sarigoz Aug 04 '15 at 15:28

2 Answers2

1

I had this problem in django 1.9. when i back to django 1.8.6. this problem was resolved.

In the other hand. you can set this.

LANGUAGE_CODE='en-us'
USE_I18N = True
USE_L10N = True
Ge4Los
  • 11
  • 2
0

I had the same problem in Django. My problem was in my project settings.py under LANGUAGE_CODE = 'en-us'. That's where my error was. I had accidentally changed LANGUAGE_CODE = 'new_timezone' instead of TIME_ZONE = 'new_timezone' and since LANGUAGE_CODE isn't a time zone I got an error. Make sure you are not changing the wrong thing in settings like I was. If you want to change LANGUAGE_CODE make sure you are doing it correctly.

Carter
  • 21
  • 1