仅在 Heroku 不支持的区域设置

Mat*_*ana 0 python django heroku

我刚刚将我的项目推送到 heroku,突然我收到以下错误:

/profile/list/48
unsupported locale setting
Error during template rendering
In template /app/Clientes/templates/Clientes/base.html, error at line 0
Run Code Online (Sandbox Code Playgroud)

问题是我在本地运行这个项目没有任何问题,在 Heroku 中,错误出现在详细视图中。

我不认为问题出在我的任何文件中,但如果需要,我可以在这里发布。

Chr*_*ris 5

heroku-buildpack-locale

为了减少堆栈图像大小,heroku 16 堆栈默认不包含语言包。不过,您可能仍想使用自定义语言包。

您可以heroku-buildpack-locale通过运行添加构建包

heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-locale
Run Code Online (Sandbox Code Playgroud)

然后.locales在存储库的根目录中创建一个新文件,其中包含

pt_BR.UTF-8
Run Code Online (Sandbox Code Playgroud)

提交并推送到 Heroku。这应该让您使用语言环境。