我正在大致按照 these 将 Yesod 应用程序部署到 Heroku指示。我可以完美部署,但是当我访问 the site 时, 它是无样式的。这似乎是因为它正在寻找一些奇怪的样式表:
<link rel="stylesheet" href="http://localhost:3000/static/combined/DtHk9AMk.css">
<link rel="stylesheet" href="http://localhost:3000/static/tmp/UEG9zQsl.css">
Yesod 为什么要生成这些 URL? Procfile specifies在生产模式下运行 Yesod 可执行文件...
最佳答案
yesod 期望 Yesod 类型类中的 approot
匹配它所在的根 url。 Yesod 书中解释了如何使用它 here .如果您使用 yesod init
生成的脚手架,approot 将来自 config/settings.yml
文件。
由于默认是 AppRootRelative
,您可以从 settings.yml
文件中删除 approot
设置并获得您想要的行为。
关于haskell - Yesod 站点链接到本地主机 CSS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18636714/