Why use Django's collectstatic instead of just serving the files directly from your static directory?

前端 未结 2 2135
天命终不由人
天命终不由人 2021-02-12 16:39

From the Django Docs:

Deployment django.contrib.staticfiles provides a convenience management command for gathering static files in a single directory s

2条回答
  •  天命终不由人
    2021-02-12 17:10

    The STATIC_ROOT can be on a different machine than the application, so copying your static files to the static root means that you can serve your static files from a different server (CDN FTW!) which you wouldn't be able to do if those files where only located within their respective app directories.

提交回复
热议问题