Use the same static file into multiple apps in Django

馋奶兔 提交于 2019-12-10 13:24:19

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/10068469/use-the-same-static-file-into-multiple-apps-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!