Verdächtige Dateioperation..Der verknüpfte Pfad ... befindet sich außerhalb der Basispfadkomponente

eim Versuch, PNG-Dateien in die Admin-Image-Tabelle hochzuladen, erhalte ich die Fehlermeldung:

SuspiciousFileOperation at / admin / products / productimage / add / Der verknüpfte Pfad (/product/images/Laptop-Computer-5_copy.png) befindet sich außerhalb der Basispfadkomponente (/ images)

hier sind meine Einstellungen:

  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

Aber wenn ich in MEDIA_ROOT 'Produkt / Bilder' (ohne Schrägstrich vor 'Produkt') hinzufüge, ist ein Fehler aufgetreten:

SuspiciousFileOperation at / admin / products / productimage / add / Der verknüpfte Pfad (/product/images/Laptop-Computer-5_copy.png) befindet sich außerhalb der Basispfadkomponente (/ Volumes / Storage / _codework / e_shop / product / images) )

u Testzwecken habe ich eine Kopie des Produkt- / Bildordners im Stammverzeichnis des Projekts abgelegt. Ansonsten, wenn der Schrägstrich vor dem Produkt steht ('/ product / images'), habe ich diesen Fehler:

OSError at / admin / products / productimage / add / [Errno 13] Berechtigung verweigert: '/ product'

Ich habe die Zugriffsrechte wie (MacOs) geändert:

chmod -R 777 / Volumes / Storage / _codework / e_shop / static / media /

un

chown -R K / Volumes / Speicher / _codework / e_shop / static / media /

aber nichts hilft. Was ist das Problem? Bitte geben Sie Hinweise. Diese Frage steht im Zusammenhang mit meiner vorherigen Fragebitte siehe

Antworten auf die Frage(2)

Ihre Antwort auf die Frage