2015-11-19 19 views
3

環境沒有翻譯文件:發現域「Django的

  • 蟒蛇2.7.10
  • Django的1.8.6(從站點包文件夾複製)

我複製Django的分佈進入我的項目文件夾。

以爲它會很好地工作

它完全在我的機器之一,但在另外一個

Traceback (most recent call last): 
    File "manage.py", line 12, in <module> 
    execute_from_command_line(sys.argv) 
    File "cmdb_lib/django/core/management/__init__.py", line 338, in execute_from_command_line 
    utility.execute() 
    File "cmdb_lib/django/core/management/__init__.py", line 330, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "cmdb_lib/django/core/management/commands/test.py", line 30, in run_from_argv 
    super(Command, self).run_from_argv(argv) 
    File "cmdb_lib/django/core/management/base.py", line 393, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "cmdb_lib/django/core/management/commands/test.py", line 74, in execute 
    super(Command, self).execute(*args, **options) 
    File "cmdb_lib/django/core/management/base.py", line 458, in execute 
    translation.activate(saved_locale) 
    File "cmdb_lib/django/utils/translation/__init__.py", line 146, in activate 
    return _trans.activate(language) 
    File "cmdb_lib/django/utils/translation/trans_real.py", line 222, in activate 
    _active.value = translation(language) 
    File "cmdb_lib/django/utils/translation/trans_real.py", line 206, in translation 
    _translations[language] = DjangoTranslation(language) 
    File "cmdb_lib/django/utils/translation/trans_real.py", line 115, in __init__ 
    self._init_translation_catalog() 
    File "cmdb_lib/django/utils/translation/trans_real.py", line 153, in _init_translation_catalog 
    translation = self._new_gnu_trans(localedir, use_null_fallback) 
    File "cmdb_lib/django/utils/translation/trans_real.py", line 136, in _new_gnu_trans 
    fallback=use_null_fallback) 
    File "/usr/local/lib/python2.7/gettext.py", line 472, in translation 
    raise IOError(ENOENT, 'No translation file found for domain', domain) 
IOError: [Errno 2] No translation file found for domain: u'django' 

但在我settings.py我設置LANGUAGE_CODE = 'en-us'爲默認拋出下面的錯誤!

這怎麼可能拋出一個錯誤?

我試圖pip install django,問題就解決了,但我還是想在自己的項目Django的packege。

我該如何做到這一點?

+1

要包括Django的包,爲什麼呢?原因將幫助我們幫助您 –

+1

'我將django分發複製到我的項目文件夾中 - 爲什麼要這樣做? –

+0

我通過''pip install django == 1.8.6''安裝了django,並將site-package/django複製到我的項目文件夾中。 –

回答

0

我想我得到了解決,我.gitignore文件忽略的.mo文件,我說這一切的OK現在

如果您正在使用Git,請檢查您.gitignore文件和註釋*.mo

添加缺少的.mo文件,事情會好