Django staticfiles with multiple applications

Let's say I have two applications:

foo and bar

project structure, as shown below, how can I make sure that application styles do not conflict? Running manage.py collectstatic dissolves either one of the files at present ... The admin application is imported into the collected directory in the "admin" folder, however, static application data is imported directly into the main directory, thus overwriting other applications if duplicate files are found

/Project /foo /static /css /style.css /views.py /models.py /urls.py /bar /static /css /style.css /views.py /models.py /urls.py /urls.py /manage.py /settings.py 
+4
source share
1 answer

Do not do it like this. With or without staticfiles / collectstatic, djando will always serve one of two style.css files. Just add the application name inside static/ . See Also, how django/contrib/(admin|auth|...)/static are laid out

 Project |-- foo | |-- static | | `-- foo | | `-- css | | `-- style.css | |-- views.py | |-- models.py | `-- urls.py |-- bar | |-- static | | `-- bar | | `-- css | | `-- style.css | |-- views.py | |-- models.py | `-- urls.py |-- urls.py |-- manage.py `-- settings.py 
+9
source

All Articles