1

I am trying to run collectstatic on heroku. When I got this error:

remote: 'component ({})'.format(final_path, base_path)) 
remote: django.core.exceptions.SuspiciousFileOperation: The joined path (/tmp/build_4652acfe079723bc273763513a187201/fonts/glyphicons-halflings-regular.eot) is located outside of the base path component (/tmp/build_4652acfe079723bc273763513a187201/staticfiles) 

I thought perhaps I had missed something with collectstatic on my end, so I ran it locally, and got the exact same error.

Then I went looking. I found:

/home/malikarumi/Projects/aishah/jamf35/staticfiles/bootstrap/fonts/glyphicons-halflings-regular.eot

and

/home/malikarumi/Projects/aishah/jamf35/static/bootstrap/fonts/glyphicons-halflings-regular.eot

My settings:

STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static/bootstrap/fonts/'),

There is a ticket out there, but it seems to be about paths, and I see nothing wrong with my paths, https://code.djangoproject.com/ticket/27201 Another one deals with files, and might be closer to my issue, because it has to do with created tmp files, but I really can't tell: https://code.djangoproject.com/ticket/26644

I should note that I also looked at Django: The joined path is located outside of the base path component, Django: How to allow a Suspicious File Operation / copy a file, and Django | joined path is located outside of the base path component {% static img.thumbnail.url %}, Error 400 with whitenoise, but they seem to be more about MEDIA ROOT issues.

I'm not sure what the fix is, here. Please advise. Thanks.

Malik A. Rumi
  • 1,855
  • 4
  • 25
  • 36

1 Answers1

3

Your STATICFILES_DIRS setting looks odd. Are you sure you don't want this?

STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'static'),]

The problem is that one of your CSS files has a relative reference which is resolving outside of the static directory, and I think that's because you have static/bootstrap/fonts where you should just have static.

D. Evans
  • 3,242
  • 22
  • 23
  • Ding ding, you get the prize. Actually, I only posted the one staticfile dir I thought was at issue, but I had a path for each subdirectory, and NONE of them should have been there, and they should NOT have had os.path in them. I took them out and it works fine. The os.path join is only for defining 'static'. I don't know what I was thinking when I set it up that way, I must have been drunk. Thx. – Malik A. Rumi Sep 18 '17 at 18:49