0

Is it possible to use templates for static files? I would like django could process the static files with template processor before copying them in the static folder when manage collectstatic is issued.

Of course the context would not contain request information but it could be useful to use such information as:

  • urls from url names to be used in javascript code
  • settings to be used to customize css or static html pages

What is the simpler way to accomplish this?

Emanuele Paolini
  • 9,912
  • 3
  • 38
  • 64

1 Answers1

0

At least in the case of JavaScript I have previously done it. Please see the reference for calling a JavaScript service worker in the following link:

Django and service workers - serve "sw.js" at application's root url

As far as the knowledge if it is a good design architecture I would not know. But may seem and interestingly enough idea to give it a try.

Santiago M. Quintero
  • 1,237
  • 15
  • 22