Questions tagged [django-media]
237 questions
0
votes
0 answers
How to return multiple images and their corresponding id from Django to reactJS
I want to send multiple images and their corresponding id from Django to react.js.
I tried to return dictionary of images with id as key in this format:
{id1:image1, id2:image2}
here,
id =
image =

newbie
- 1
- 2
0
votes
1 answer
Django media image file is not displaying in template
I have a problem with media files in Django 4.0.4, here are the code and some screenshots to understand the problem :
Settings.py
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
MEDIA_ROOT = BASE_DIR / 'media'
MEDIA_URL =…

Mhamed Bendenia
- 180
- 1
- 8
0
votes
0 answers
Django profile picture does not upload
This question was asked I don't know how much but it doesn't give my answers
The app I was gonna make is a little blog webapp from a tutorial (for some training in Django, it's the first time I use it so...)
There is my code:
# models
from django.db…
user18180682
0
votes
1 answer
Generating thumbnail manually and uploading it in S3 bucket
My web app is image-centric and when a user uploads an image (any size), I need to create a thumbnail and store so that I can use the thumbnail and not the original image. I use AWS S3 bucket, boto3, django-storages. The file upload works…

Rhonald
- 363
- 5
- 18
0
votes
0 answers
uploading image in Django inside a for loop
I wanted show the uploaded image from admin url in my index.html template. so i needed to put a for loop and I got a probelm in image src.
setting.py :
STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static"
]
models.py :
class…

Manny
- 29
- 4
0
votes
0 answers
Django Media Files Not Showing
My Django files are loading after upload and are shown in the media folder, however I cannot access them at localhost:/media/. I've looked at several other answers on stackoverflow and they haven't worked. For example adding the…

yosemeti
- 206
- 4
- 15
0
votes
1 answer
How to reduce response time of the web page to minimum in django?
Currently my network speed is about 1.5s per page if there are images in that page, If i move to different pages with image, audio and video file in it then loading of page takes around 2s to 2.5s. What i want to know is if there is a way to bring…

Srijan113
- 89
- 8
0
votes
1 answer
Video not playing on Django when debug=False
Videos are not playing when I turn DEBUG to False on Django, but on DEBUG=True, everything is fine.
The task is simple, the app receives youtube shorts link, downloads it to the MEDIA_ROOT (which declared in settings.py as BASE_DIR / 'media'). And…

Asadbek Advenn
- 53
- 6
0
votes
2 answers
Django STATIC FILES not loading in actual Production
I have tried many things to solve this like adding whitenoise middleware, also added STATICFILES_DIRS = [], added mimetypes for css
in settings.py file CSS/JS Won't load.
Here is my settings.py
from pathlib import Path
import environ
import…

Rajat Jog
- 21
- 2
0
votes
1 answer
how to use a media file in a django view, in other words, how do i get the address of the media file in a view
I have Included the following in my settings.py:
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
This is the model whose FileInput i have to store:
class Clip(models.Model):
owner = models.ForeignKey(User,…

Apoorva Shridhar
- 147
- 14
0
votes
5 answers
How do i get to know if an image is rendered in a webpage? (django templates)
I ahve this code, the trouble is few of the images are having names, but corresponding to the names the files are not present, how can i know if the images are being displayed, i mean some if statement of something like that.

Ram Kumar
- 590
- 2
- 10
- 27
0
votes
2 answers
How to serve django media files with docker and nginx?
My setup for dockerizing & serving the Django app is a bit different when it comes to Nginx so the solutions I found didn't help.
I have dockerized the django app and its working fine except the media files. I am not using nginx inside the container…

Erlich Bachman
- 112
- 11
0
votes
1 answer
How can I save Instagram stories in my media folder using media url?
def save_media(story_id, media_url):
try:
link = media_url[:media_url.find('?')]
extension = link[::-1][:link[::-1].find('.')+1][::-1]
if 'video' in media_url:
extension = '.mp4'
filepath = r'{0}\file path for media…

Vishal Pandey
- 349
- 1
- 4
- 15
0
votes
1 answer
django html file load image like `{{post.image.url}}`
models.py
class Post(models.Model):
image = models.FileField(upload_to='note/static/note/')`
template
user15368062
0
votes
0 answers
I want to load a static file from django template like.. {% static {{post.image}} %}
I want to load a static file from django template like.. {% static {{post.image}} %} but is error
Can you show me code like this?
Did you understand? Need more clarification?
user15368062