[Django]-How to update where the files are stored in Django app

0👍

To organize files by models in a Django app: Create subdirectories for each model in the media folder, update upload_to paths in FileFields, move existing files, and test.

class ModelA(models.Model):
    file = models.FileField(upload_to='modela/')

class ModelB(models.Model):
    file = models.FileField(upload_to='modelb/')

Leave a comment