title: Suspicious File Operation..The joined path ... is located outside of the base path component
body: <p>Trying upload .png files into admin image table I get error:</p>
  
  <blockquote>
    <p>SuspiciousFileOperation at /admin/products/productimage/add/
    The joined path (/product/images/Laptop-Computer-5_copy.png) is located outside of the base path component (/images)</p>
  </blockquote>
  
  <p>here is my settings :</p>
  
  <pre><code>  import os
  
  
  
  # BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)))
  
  '''path settings for django==1.8'''
  
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
  
  TEMPLATE_DIRS = (
      #'/Users/jmitch/Desktop/seven/static/templates/',
      os.path.join(os.path.dirname(os.path.dirname(BASE_DIR)), "static", "templates"),
  )
  
  # STATICFILES_FINDERS = (
  #     'django.contrib.staticfiles.finders.FileSystemFinder',
  #     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  #     #'django.contrib.staticfiles.finders.DefaultStorageFinder',
  # )
  
  TEMPLATES = [
          {
              'BACKEND': 'django.template.backends.django.DjangoTemplates',
              # 'DIRS': [BASE_DIR+"/templates", ],
              'DIRS': [BASE_DIR + "/static/templates/", ],
              'APP_DIRS': True,
              'OPTIONS': {
                  'context_processors': [
                      'django.template.context_processors.debug',
                      'django.template.context_processors.request',
                      'django.contrib.auth.context_processors.auth',
                      'django.contrib.messages.context_processors.messages',
                      'django.core.context_processors.media',
                      'django.template.context_processors.media',
                  ],
              },
          },
      ]
  ENV_PATH = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
  MEDIA_ROOT = os.path.join(ENV_PATH, '/images')
  # MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static', 'media')
  # MEDIA_ROOT = '/Volumes/Storage/_codework/e_shop/static/media/product/images/'
  
  
  STATIC_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'static', 'static-only')
  
  STATIC_URL = '/static/'
  
  STATICFILES_DIRS = (
      os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'static', 'static'),
  )
  # MEDIA_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(BASE_DIR))), "static", "media")
  MEDIA_URL = '/media/'
  enter code here
  </code></pre>
  
  <p>but when in MEDIA_ROOT I add 'product/images' (without slash before 'product')
  an error occurred:</p>
  
  <blockquote>
    <p>SuspiciousFileOperation at /admin/products/productimage/add/
    The joined path (/product/images/Laptop-Computer-5_copy.png) is located outside of the base path component (/Volumes/Storage/_codework/e_shop/product/images)</p>
  </blockquote>
  
  <p>although for testing purposes I placed  copy of product/images folder in the root of project. Otherwise when slash is before product('/product/images')I have got that error: </p>
  
  <blockquote>
    <p>OSError at /admin/products/productimage/add/[Errno 13] Permission denied: '/product'</p>
  </blockquote>
  
  <p>I've changed rights for access like(MacOs): </p>
  
  <blockquote>
    <p>chmod -R 777 /Volumes/Storage/_codework/e_shop/static/media/</p>
  </blockquote>
  
  <p>and </p>
  
  <blockquote>
    <p>chown -R K /Volumes/Storage/_codework/e_shop/static/media/</p>
  </blockquote>
  
  <p>but nothing helps.
  What the problem?Please give any advises.This question is related to my previous question <a href="https://stackoverflow.com/questions/33592380/media-root-django-do-not-find-images">please see</a></p>