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

I get SuspiciousFileOperation #26

Closed
pebreo opened this issue Mar 5, 2018 · 4 comments
Closed

I get SuspiciousFileOperation #26

pebreo opened this issue Mar 5, 2018 · 4 comments

Comments

@pebreo
Copy link

pebreo commented Mar 5, 2018

I am running:

  • Django 1.8.18
  • django-pipeline 1.6.14 and
  • django-pipeline-browserify 0.6.2
    and I get this error:

django.core.exceptions.SuspiciousFileOperation: The joined path (/) is located outside of the base path component (/Users/paul/angular-rest/web/web/backend/static)

My settings look like this:

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]
STATIC_ROOT = os.path.join(BASE_DIR, "static/dist")
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
STATICFILES_FINDERS = (
 'django.contrib.staticfiles.finders.FileSystemFinder',
 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
 'pipeline.finders.PipelineFinder',
)

PIPELINE = {
    'PIPELINE_ENABLED': False, 
    'JAVASCRIPT': {
        'browserify':{
            'source_filenames': (
                'js/pong/main.browserify.js'
            ),
            'output_filename': os.path.join(BASE_DIR, "js/app.js")
        }
    },
    'COMPILERS': ('pipeline_browserify.compiler.BrowserifyCompiler', ),
}

PIPELINE['BROWSERIFY_BINARY'] = '/usr/local/bin/browserify'

Someone had this problem in 2013 for django-pipeline but they fixed it here (jazzband/django-pipeline#211). If you have time, can you take a look at it? I'm afraid a lot of the code is way over my head.

For your convenience, I was able to reproduce the issue in this starter project which was created via django-admin startproject myproject. I placed the project (along with the sqlite3 db) here:

https://github.com/pebreo/dj18-browserify-issue

@naitian
Copy link

naitian commented Jul 15, 2018

Super late, and not the maintainer, but I figured I'd answer the question because I just had this problem last night.

You're missing a comma after 'js/pong/main.browserify.js'.

Since source_filenames should be a tuple, there needs to be a comma even after the first item. Otherwise, pipeline will mistakenly read source_filenames as a string instead of a tuple, and (I'm assuming) iterate through every character of 'js/pong/main.browserify.js' as if it were a separate path.

@Zeeerooo
Copy link

Thanks @naitian !

@bellydrum
Copy link

Thank you so much @naitian

@diegueus9
Copy link

diegueus9 commented Jun 17, 2020

@naitian you're a lifesaver, sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants