2017-02-23 7 views
0

ジャンゴが見つかりません翻訳ファイル窓 サーバー:DebianのOSErrorの:ローカル1.10.3 :デフォルトの言語zh_Hans

、私のサーバーにruningてすることはできません正常に実行することができますローカル、しかしen-usによりruningてすることができ、なぜ、 zh_hansでランニングできないのですか?

トレースバック:

 ...File "/home/a/ENV/lib/python3.5/site-packages/django/utils/translation/__init__.py", line 85, in ugettext 
     return _trans.ugettext(message) 
     File "/home/a/ENV/lib/python3.5/site-packages/django/utils/translation/trans_real.py", line 337, in gettext 
     return do_translate(message, 'gettext') 
     File "/home/a/ENV/lib/python3.5/site-packages/django/utils/translation/trans_real.py", line 320, in do_translate 
     _default = _default or translation(settings.LANGUAGE_CODE) 
     File "/home/a/ENV/lib/python3.5/site-packages/django/utils/translation/trans_real.py", line 227, in translation 
     _translations[language] = DjangoTranslation(language) 
     File "/home/a/ENV/lib/python3.5/site-packages/django/utils/translation/trans_real.py", line 134, in __init__ 
     raise IOError("No translation files found for default language %s." % settings.LANGUAGE_CODE) 
    OSError: No translation files found for default language zh_Hans. 

アップデータ:あなたが使用する必要がありますsettings.py

""" 
 
Django settings for aWebsite project. 
 

 
Generated by 'django-admin startproject' using Django 1.10.3. 
 

 
For more information on this file, see 
 
https://docs.djangoproject.com/en/1.10/topics/settings/ 
 

 
For the full list of settings and their values, see 
 
https://docs.djangoproject.com/en/1.10/ref/settings/ 
 
""" 
 

 
import os 
 

 
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
 
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
 

 

 
# Quick-start development settings - unsuitable for production 
 
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ 
 

 
# SECURITY WARNING: keep the secret key used in production secret! 
 
SECRET_KEY = 'a*x^k((1zswa$g_qu70f%%8mb6z7p1tfzy%&[email protected]+3zdafv3h' 
 

 
# SECURITY WARNING: don't run with debug turned on in production! 
 
DEBUG = False 
 
TEMPLATE_DEBUG = False 
 

 
ALLOWED_HOSTS = ['aWebsite.com'] 
 

 

 
# Application definition 
 

 
INSTALLED_APPS = [ 
 
    'grappelli', 
 
    'django.contrib.admin', 
 
    'django.contrib.auth', 
 
    'django.contrib.contenttypes', 
 
    'django.contrib.sessions', 
 
    'django.contrib.messages', 
 
    'django.contrib.staticfiles', 
 
    'ckeditor', 
 
    'ckeditor_uploader', 
 
    'imagekit', 
 
    'Website', 
 
] 
 

 
MIDDLEWARE = [ 
 
    'django.middleware.security.SecurityMiddleware', 
 
    'django.contrib.sessions.middleware.SessionMiddleware', 
 
    'django.middleware.common.CommonMiddleware', 
 
    'django.middleware.csrf.CsrfViewMiddleware', 
 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
 
    'django.contrib.messages.middleware.MessageMiddleware', 
 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
 
] 
 

 
ROOT_URLCONF = 'aWebsite.urls' 
 

 
TEMPLATES = [ 
 
    { 
 
     'BACKEND': 'django.template.backends.django.DjangoTemplates', 
 
     'DIRS': [os.path.join(BASE_DIR, 'templates')] 
 
     , 
 
     'APP_DIRS': True, 
 
     'OPTIONS': { 
 
      'context_processors': [ 
 
       'django.template.context_processors.debug', 
 
       'django.template.context_processors.request', 
 
       'django.contrib.auth.context_processors.auth', 
 
       'django.contrib.messages.context_processors.messages', 
 
      ], 
 
     }, 
 
    }, 
 
] 
 

 
WSGI_APPLICATION = 'hitekCable.wsgi.application' 
 

 

 
# Database 
 
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases 
 

 
DATABASES = { 
 
    'default': { 
 
     'ENGINE': 'django.db.backends.sqlite3', 
 
     'NAME': os.path.join(BASE_DIR, 'sdefg.sqlite3'), 
 
    } 
 
} 
 

 

 
# Password validation 
 
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators 
 

 
AUTH_PASSWORD_VALIDATORS = [ 
 
    { 
 
     'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 
 
    }, 
 
    { 
 
     'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 
 
    }, 
 
    { 
 
     'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 
 
    }, 
 
    { 
 
     'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 
 
    }, 
 
] 
 

 

 
# Internationalization 
 
# https://docs.djangoproject.com/en/1.10/topics/i18n/ 
 

 
#LANGUAGE_CODE = 'zh_Hans' 
 
LANGUAGE_CODE = 'en-us' 
 

 
TIME_ZONE = 'Asia/Shanghai' 
 

 
USE_I18N = True 
 

 
USE_L10N = True 
 

 
USE_TZ = True 
 

 

 
# Static files (CSS, JavaScript, Images) 
 
# https://docs.djangoproject.com/en/1.10/howto/static-files/ 
 

 
STATIC_URL = 'http:/aWebsite.com/static/' 
 
STATIC_ROOT = os.path.join(BASE_DIR, 'collected_static') 
 

 
STATICFILES_DIRS = [(os.path.join(BASE_DIR, 'Website/static'))] 
 

 
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') 
 
MEDIA_URL = 'http://aWebsite.com/media_hitek/' 
 

 

 
CKEDITOR_UPLOAD_PATH = "uploads/" 
 
CKEDITOR_UPLOAD_SLUGIFY_FILENAME = True 
 
CKEDITOR_ALLOW_NONIMAGE_FILES = False 
 
CKEDITOR_RESTRICT_BY_USER = True 
 
CKEDITOR_IMAGE_BACKEND = 'pillow' 
 
CKEDITOR_JQUERY_URL = '//cdn.bootcss.com/jquery/2.2.4/jquery.min.js' 
 
CKEDITOR_CONFIGS = { 
 
    'default': { 
 
     'skin': 'moono', 
 
     # 'skin': 'office2013', 
 
     'toolbar_Basic': [ 
 
      ['Source', '-', 'Bold', 'Italic'] 
 
     ], 
 
     'toolbar_YourCustomToolbarConfig': [ 
 
      {'name': 'document', 'items': ['Source', '-', 'Print', '-', 'Templates']},#'Save', 'NewPage', 'Preview', 
 
      {'name': 'clipboard', 'items': ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo']}, 
 
      {'name': 'editing', 'items': ['Find', 'Replace', '-', 'SelectAll']}, 
 
      {'name': 'forms', 
 
      'items': ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 
 
         'HiddenField']}, 
 
      '/', 
 
      {'name': 'basicstyles', 
 
      'items': ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']}, 
 
      {'name': 'paragraph', 
 
      'items': ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 
 
         'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 
 
         'Language']}, 
 
      {'name': 'links', 'items': ['Link', 'Unlink', 'Anchor']}, 
 
      {'name': 'insert', 
 
      'items': ['Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe']}, 
 
      # '/', 
 
      {'name': 'styles', 'items': ['Styles', 'Format', 'Font', 'FontSize']}, 
 
      {'name': 'colors', 'items': ['TextColor', 'BGColor']}, 
 
      {'name': 'tools', 'items': ['Maximize', 'ShowBlocks']}, 
 
      # {'name': 'about', 'items': ['About']}, 
 
      # '/', # put this to force next toolbar on new line 
 
      # {'name': 'yourcustomtools', 'items': [ 
 
      #  # put the name of your editor.ui.addButton here 
 
      #  'Preview', 
 
      #  'Maximize', 
 
      # 
 
      # ]}, 
 
     ], 
 
     'toolbar': 'YourCustomToolbarConfig', # put selected toolbar config here 
 
     # 'toolbarGroups': [{ 'name': 'document', 'groups': [ 'mode', 'document', 'doctools' ] }], 
 
     # 'height': 291, 
 
     # 'width': '100%', 
 
     # 'filebrowserWindowHeight': 725, 
 
     # 'filebrowserWindowWidth': 940, 
 
     # 'toolbarCanCollapse': True, 
 
     # 'mathJaxLib': '//cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML', 
 
     'tabSpaces': 4, 
 
     'extraPlugins': ','.join(
 
      [ 
 
       # your extra plugins here 
 
       'div', 
 
       'autolink', 
 
       'autoembed', 
 
       'embedsemantic', 
 
       'autogrow', 
 
       # 'devtools', 
 
       'widget', 
 
       'lineutils', 
 
       'clipboard', 
 
       'dialog', 
 
       'dialogui', 
 
       'elementspath' 
 
      ]), 
 
    } 
 
}

+0

設定ファイルを共有できますか? –

+0

はい、あなたは今見ることができます。 – zofan

+0

さて、zh_Hansをデフォルト言語として使用する場合、同じ言語の翻訳ファイルを提供する必要があります。 Djangoに翻訳ファイルの検索場所を知らせるために、設定ファイルに設定する必要のある変数はほとんどありません。ドキュメントを見て、そこに記載されている手順に従ってください。 –

答えて

0

LANGUAGE_CODE = 'ZH-ハンス'

また、django-admin makemessages -l zh_hansを使用する場合

注:1つはzh-hans、1つはzh_hansです。

関連する問題