[Fixed]-Django uploading file not in MEDIA_ROOT path is giving me SuspiciousOperation error


Yes there is a way:

From docs:

For example, the following code will
store uploaded files under
/media/photos regardless of what your
MEDIA_ROOT setting is:

from django.db import models
from django.core.files.storage import FileSystemStorage

fs = FileSystemStorage(location='/media/photos')

class Car(models.Model):
    photo = models.ImageField(storage=fs)

Leave a comment