1

A template builds a file that can be stored in:

project/output/

or:

project/output/type/

I want to access static files stored in: project/output/static How to make it so it has the right src= in both cases?

src="project/output/static"

won't work locally because locally you need: home/user/project/output

This works for both production and locally but only in 1 case of 2: ../../output/static etc.

Root relative url should work(/output/static) but instead of:

home/user/project/output/static

it points to:

output/static

  • Does this answer your question? [Absolute vs relative URLs](https://stackoverflow.com/questions/2005079/absolute-vs-relative-urls) – IMSoP Mar 13 '22 at 18:51
  • Not really as when I use /output/static/ locally it links to only it without project before it. If I use project in it it won't work for production. From these Examples none seem to fit – Hubert Budny Mar 13 '22 at 19:07
  • Then you'll need to do something in whatever language you've written your template in, but you don't mention what that is, so it's hard for anyone to help with it. – IMSoP Mar 13 '22 at 19:59
  • I'm not sure if I understand what you're saying. The template is written in html. What context should I add? File generation is done in python but it is over thousand of lines of code and I was hoping for a solution that doesn't interfere the generator – Hubert Budny Mar 13 '22 at 20:14
  • A "template" generally has variables, conditions, that kind of thing; HTML on its own doesn't have those things, so "HTML template" would normally refer to the thing that was *generating* the HTML. If you need to have a different base URL on different servers, having that base URL as a variable in that template is probably the best way to do it. – IMSoP Mar 13 '22 at 20:40

0 Answers0