L
L
leo97972019-07-17 09:45:32
css
leo9797, 2019-07-17 09:45:32

How to use per app's own styles in Django template?

I have a Django project consisting of many applications that contain css styles in each of their own and there is an html file that determines which application is currently being used by reference.
How is it possible without connecting all the styles of each application, for example, connect one style that determined which application is being used right now and used the style of this application for it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Kuzmichev, 2019-07-23
@leo9797

and there is an html file that determines by reference which application is currently being used.

Do not do it this way.
Django allows each application to create its own templates and static files - css, js, etc. Templates can be inherited from each other - this is the key point for their logical organization even for a small project, not to mention large ones.
You can create one common parent layout template for the entire project, in it connect the statics common to the project (all sorts of jquery and other libs there).
Each application, in turn, creates its own layout or template, inherited from the general one, and specific css / js of a specific application is already additionally connected in it.
Google about template inheritance, blocks in them, and how to override these blocks in inherited templates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question