为什么collectstatic无法复制我的静态文件? [英] why collectstatic won't copy my static files?

查看:247
本文介绍了为什么collectstatic无法复制我的静态文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有MyApp / static / MyApp目录

I have MyApp/static/MyApp directory

当我运行./manage.py collectstatic时,我希望将MyApp目录复制到STATIC_ROOT,但不会

When I run ./manage.py collectstatic, I expect the MyApp directory be copied to STATIC_ROOT but it doesn't

我也有DownloadedApp / static / DownloadedApp,并将其复制到STATIC_ROOT罚款。

I have DownloadedApp/static/DownloadedApp as well and its copied to STATIC_ROOT fine.

我想念什么?

推荐答案

什么是 STATIC_ROOT STATICFILES_FINDERS STATICFILES_DIRS 在您的 settings.py 中?

运行 collectstatic 时,默认 STATICFILES_FINDERS django。 contrib.staticfiles.finders.FileSystemFinder 将从您在 STATICFILES_DIRS 中具有的任何路径中收集静态文件。

When collectstatic is run, the default STATICFILES_FINDERS value django.contrib.staticfiles.finders.FileSystemFinder will collect your static files from any paths that you have in STATICFILES_DIRS.

另一个默认 STATICFILES_FINDERS django.contrib.staticfiles.finders.AppDirectoriesFinder 将显示在 INSTALLED_APPS 中任何应用程序的 / static / 文件夹中。

The other default STATICFILES_FINDERS value django.contrib.staticfiles.finders.AppDirectoriesFinder will look in the /static/ folder of any apps in your INSTALLED_APPS.

所有找到的静态文件将放置在指定的 STATIC_ROOT 目录中。

All of the static files that are found will be placed in the specified STATIC_ROOT directory.

查看此链接, collectstatic文档

并且此链接说明了settings.py

中的各种静态设置。您还可以使用 python manage .py findstatic 来查看 collectstatic 将进入哪些目录。

You can also use python manage.py findstatic to see which directories collectstatic will look in.

这篇关于为什么collectstatic无法复制我的静态文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆