Instead of saving the images in the root "media\devices" directory, it saves them in "web01\media\devices". What's going on? Thanks.
models.py file
class ImagenDispositivo(models.Model):
name = models.CharField('Nombre',max_length=50)
image = models.ImageField(upload_to='dispositivos/')
class Meta:
verbose_name = 'Imagen dispositivo'
verbose_name_plural = 'Imagen de dispositivos'
ordering = ['name']
def __str__(self):
return self.name
settings>local.py
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
settings>base.py
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
That happens because you have a settings/base.py folder instead of a settings.py file.
The solution is to change your BASE_DIR to this:
Your old BASE_DIR only went up 2 levels, but with this one I left you it goes up 3 levels.