TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not list (Django)

TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not list (Django)

我正在尝试通过管理面板中的 'Customer' 模型向客户添加个人资料照片。

models.py

from django.contrib.auth.models import User

class Customer(models.Model):
    user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
    name = models.CharField(max_length=200, null=True)
    phone = models.CharField(max_length=200, null=True)
    email = models.CharField(max_length=200, null=True)
    profile_pic = models.ImageField(null=True, blank=True)
    date_created = models.DateTimeField(auto_now_add=True, null=True)
    
    def __str__(self):
        return self.name

settings.py

STATIC_URL = '/static/'

MEDIA_URL = '/imagenes/'

STATICFILES_DIRS = [
    BASE_DIR / "static",
]
 
MEDIA_ROOT = [BASE_DIR/'static/images']

我想我在设置静态文件路径时出错了;事实是我对配置它的方式知之甚少,而且我不明白为什么会发生错误。请有人帮助我

settings.MEDIA_ROOT 应该是路径而不是列表,您需要更改设置。让你的静态目录和媒体目录重叠也不是一个好主意,你应该为你的媒体使用一个唯一的目录

MEDIA_ROOT = BASE_DIR / 'media'

https://docs.djangoproject.com/en/3.2/ref/settings/#media-root