Let's say I have two apps:
foo and bar
the project structure like below, how do I make sure app styles do not conflict? Running manage.py collectstatic dissolves either one of the files currently... The admin app is imported to the collected directory within an 'admin' folder however my app static data gets imported directly into the main directory thus overwriting other apps 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
Don't do that this way. With or without staticfiles/collectstatic, djando would ever serve one of the two style.css
files. Just prepend the app 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With