Hi,
Briefly, this works:
plug Plug.Static,
at: "/uploads", from: Path.expand("./"), gzip: false
But when I move the files up to the parent directory, this doesn’t:
plug Plug.Static,
at: "/uploads", from: Path.expand("../"), gzip: false
Could static files be located outside of the app directory and still be served?
Thanks,
Germain
1 Like
You can’t expect non-sourve files outside of the ./priv
directory to be there in production deploys. This can be changed via configuration but anything outside of your project directory is even less reliable.
3 Likes
100% true! Therefore when files are saved, the path of your uploads must start like this:
root = Path.join(:code.priv_dir(:my_app), "static")
in order to match the path of the priv directory of my_app at run-time.
3 Likes