import os
from urllib.parse import urljoin
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.utils.deconstruct import deconstructible


@deconstructible
class MyFileSystemStorage(FileSystemStorage):

    def __init__(self, subdir):
        self.subdir = subdir
super(MyFileSystemStorage, self).__init__(location=os.path.join(settings.
    MEDIA_ROOT, self.subdir), base_url=urljoin(settings.MEDIA_URL, self.subdir)
    )

def __eq__(self, other):
    return self.subdir == other.subdir
Django migrations and FileSystemStorage depending on settings