why collectstatic won't copy my static files?

前端 未结 7 1899
野的像风
野的像风 2021-02-05 10:07

I have MyApp/static/MyApp directory

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

I have Downloaded

7条回答
  •  醉梦人生
    2021-02-05 10:44

    What are the STATIC_ROOT, STATICFILES_FINDERS, and STATICFILES_DIRS in your settings.py?

    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.

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

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

    Check out this link to the collectstatic docs

    And this link an explanation of the various static settings in settings.py

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

提交回复
热议问题