0

I'm trying to make a video/thumbnail model for displaying some videos. It shows the video and I can access the video file (FileField) in the browser, however, I get a 404 error for the thumbnail (ImageField). Since I can access the videos, I assume the media settings are working just fine.

def get_video_upload_path(instance, filename):
    name, ext = filename.split('.')
    return os.path.join(f'videos/{instance.slug}.{ext}')


def get_video_thumbnail_upload_path(instance, filename):
    name, ext = filename.split('.')
    return os.path.join(f'videos/thumbnail/{instance.slug}.{ext}')

class Video(base_model):
    thumbnail = models.ImageField(
        blank=True, upload_to=get_video_thumbnail_upload_path)
    video = models.FileField(
        upload_to=get_video_upload_path)
Ivan Starostin
  • 8,798
  • 5
  • 21
  • 39
Kurosh Ghanizadeh
  • 539
  • 1
  • 4
  • 16

0 Answers0