Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files not found? #699

Open
chrisspen opened this issue Sep 22, 2019 · 2 comments
Open

Files not found? #699

chrisspen opened this issue Sep 22, 2019 · 2 comments

Comments

@chrisspen
Copy link

I really hope I'm missing something, because after following the install and configuration docs to the letter, I couldn't get pipeline to work under Django 2.2. Static collection worked and files were minimized and placed in my root static directory, but all requests for files returned a 404 error.

Per the install instructions, I have the default Django filesystem and app finders, as well as Pipeline's custom finder in my settings like:

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
)

So I dug into all the finders and added breakpoints, and I found something curious in PipelineFinder. The file system finder finds nothing because I have no custom static directories (other than my STATIC_ROOT, which Django's FileSystemFinder doesn't check). The app finder finds nothing because Pipeline's generated files go into the STATIC_ROOT, which doesn't belong to any app. Then it gets to PipelineFinder. On line 15 of pipeline/finders.py is:

def find(self, path, all=False):
    if not settings.PIPELINE_ENABLED:
        return super(PipelineFinder, self).find(path, all)
    else:
        return []

If I'm reading this correctly, this is saying "If pipeline is enabled then find no files that pipeline generates". Is that correct? Because if so, that explains why pipeline's broken in Django 2.2. If I modify this to:

def find(self, path, all=False):
        return super(PipelineFinder, self).find(path, all)

then Pipeline works perfectly, and all the minified files generated by collectstatic are correctly found and served. However, I have to assume I'm missing something or misconfigured something, because I can't believe the default finder would purposely not find Pipeline's own minified files.

@Pyvonix
Copy link

Pyvonix commented Dec 26, 2019

Can we close this issue if the support was been done for Django 2.2?

@JoePotentier
Copy link

+1

SilviaAmAm added a commit to maykinmedia/django-pipeline that referenced this issue May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants