Recently, Django's static file configuration went crazy. let's look at the underlying code: Use manage finstatic XXXX first. JS looks at the processing logic and finds that it mainly involves: C: \ python27 \ Lib \ Site-packages \ Django \ contrib \ staticfiles \ finders. find function in Py, as follows:
Debug the find method of the filesystemfinder class in C: \ python27 \ Lib \ Site-packages \ Django \ contrib \ staticfiles \ finders. py:
Shit happens, because locations is empty, cannot be found. How does it assign values? As follows:
Conclusion: you need. define staticfiles_dirs in Py, so that Django will know where to find it. instead of defining static_root, If you think so, you are as wishful thinking as I do. this variable is used for manage collectstatic. what a shit.
This is the search logic of the project.
What about apps? By default, search for the folder defined by static_url in the app. So, you see? The search logic in the app is as follows (first, then below ):
Django static file search logic