为什么 collectstatic 不会复制我的静态文件? [英] Why won't collectstatic copy my static files?
问题描述
我有一个 MyApp/static/MyApp
目录.
当我运行 ./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
将在任何应用程序的 /static/
文件夹中查找你的INSTALLED_APPS
.
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.
您也可以使用 python manage.py findstatic
来查看 collectstatic
将查找哪些目录.
You can also use python manage.py findstatic
to see which directories collectstatic
will look in.
这篇关于为什么 collectstatic 不会复制我的静态文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!