Serve media in view mode
View.py
file_path = Tracks.objects.get(pk=event_id)
name = file_path.file.name
fullpath = os.path.abspath(name)
When I perform the above function, the full path is thrown below the error:
[Errno 2] No such file or directory: '/home/ri/studio/videotube/uploads/2014/10/15/Wildlife_512kb_hVnnOc2.mp4'
But the actual file is in file:///home/ri/studio/videotube/videotube/site_media/media/uploads/2014/10/15/Wildlife_512kb_hVnnOc2.mp4
This is my media root MEDIA_ROOT = os.path.join(PACKAGE_ROOT, "site_media", "media")
What should I do to get media url in view function?
user4139972
source
share