我使用html文件作为模板,其中包含以下代码,在dev模式下工作(而不是在exrm版本中):
{:ok, template} = File.read "priv/static/templates/receipt_template.html"当使用exrm打包发行版时,此相对路径不再有效,无法找到该文件。有没有更好的方法来声明路径,这样当它变成发行版时就不会被搞砸了?
发布于 2015-11-08 01:41:23
使用Path.join("#{:code.priv_dir(:your_app_name)}", "static/templates/receipt_template.html")获得正确的路径。我建议始终使用它,因为不管环境如何,它都能工作。
https://stackoverflow.com/questions/33589509
复制相似问题