我的设置中有自定义语言环境路径
PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
LOCALE_PATHS = (
os.path.join(PROJECT_ROOT,'templates','v1','locale'),
)
但是当我尝试创建 .po 文件时,出现错误:
$ python manage.py makemessages --locale=ru
CommandError: This script should be run from the Django Git tree or your project or app tree. If you did indeed run it from the Git checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.
为什么 django 不想使用 LOCALE_PATHS?
绝对路径为: PROJECT_ROOT = '/home/creotiv/ENVS/project_env/project/project' LOCALE_PATHS = ('/home/creotiv/ENVS/project_env/project/project/templates/v1/locale')
PS:我还向主应用程序添加了翻译,而 django 也没有看到它。