python - 在 Django 中翻译文件时的 Git 命令

标签 python django translation

我在 Django 中有一个现有的应用程序。 我想在页面上添加翻译。 在我的页面上:

{% trans 'Projects'%}

在我添加的.po文件中:

#: templates/staff/site.html: 200
msgid "Projects"
msgid "Projekty"

然后执行命令:

django-admin.py compilemessages -l pl

执行此命令后,出现错误:

CommandError: This Should Be Run script from the Django Git checkout or your project or app tree, or with the settings Specified module.

最佳答案

$ python manage.py compilemessages --settings nsp.settings

CommandError: This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.

当我真的在项目根文件夹中时,我遇到了这个错误。 问题是,我在没有先使用 python manage.py makemessages 的情况下运行此命令。

错误信息具有误导性。

关于python - 在 Django 中翻译文件时的 Git 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29027242/

相关文章:

python - 使 while 解析函数递归

python - 根据另一个 df 中的列计算一个 df 中的行数

python - Python 中的简单 if-else 语句

python - Django 在之前已设置外键的同一记录中填充值

localization - 如何在微 Controller 上支持多种语言?

c - 将 C 代码转换为 MIPS 汇编代码

c++ - Qt 从非源文件中翻译字符串

python - 没有名为 'Cython' 的模块与 tar.gz 的 pip 安装

python - django模板日期过滤格式字符串问题

python - 如何在 Django REST Framework 中对图片上传进行单元测试