PythonAnywhere
PythonAnywhere

Reputation: 309

How to collect Django static files with the same name?

Three of my Django apps have static files with the same name app1/static/css/mycss.css, app2/static/css/mycss.css, app3/static/css/mycss.css. How do I collect them all to STATIC_ROOT since default behavior of DJango is to collect only the first one encountered among the same named static file?

Upvotes: 1

Views: 483

Answers (1)

e4c5
e4c5

Reputation: 53744

If you don't want the static files to be getting in each others way, give them their own name space by creating a suitable folder structure. Example

app1/static/css/app1/mycss.css
app2/static/css/app2/mycss.css

Alternatively if you want to combine all the CSS into one big CSS look into django-compressor

Upvotes: 2

Related Questions