9

My Django project is divided into several apps, and the static files are stored in each app like this:

/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

But I am not sure how to use the same static files into multiple apps.

Ryan Rho
  • 515
  • 5
  • 18

1 Answers1

8

This is what the STATICFILES_DIRS setting is for:

Your project will probably also have static assets that aren’t tied to a particular app. The STATICFILES_DIRS setting is a tuple of filesystem directories to check when loading static files. It’s a search path that is by default empty.

user8193706
  • 2,387
  • 2
  • 8
  • 12
Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284
  • 1
    So which style.css will be loaded in topic starter's case? – devmiles.com Jul 12 '12 at 13:57
  • 2
    The above link doesn't exist anymore. Refer to this: https://docs.djangoproject.com/en/1.10/howto/static-files/ instead ... It is django's goto guide concerning referencing static files from different django apps. – Efe Ariaroo Oct 07 '16 at 16:14