问题描述
我正在使用i18n在Django项目中设置国际化。在/ landing / locale / es / LC_MESSAGES中,我创建了一个包含短语的po文件并启动python manage.py compilemessages,它运行正常,但是在启动服务器时出现此错误:
File ".../venv/lib/python3.6/site-packages/django/contrib/auth/forms.py",line 10,in <module>
from django.contrib.auth.models import User
File "...venv/lib/python3.6/site-packages/django/contrib/auth/models.py",line 33,in <module>
class Permission(models.Model):
File ".../venv/lib/python3.6/site-packages/django/db/models/base.py",line 111,in __new__
"INSTALLED_APPS." % (module,name)
RuntimeError: Model class django.contrib.auth.models.Permission doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
这仅在西班牙语中出现,或带有“`”符号。如果删除.mo转换文件,服务器将正常启动。我认为问题是编码。有什么方法可以为翻译文件设置UTF-8编码? 我对.po文件使用UTF-8编码
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)