Questions tagged [django-media]

237 questions
1
vote
2 answers

Django/Apache2 not serving media files in production when "manually" added new media

I'm using Django (Django 4.0.3.) with Apache2 to run a webserver and serving media locally. Part of the site is a warehouse item tracker and is working fine, user can upload media (images) to items, categories etc and everything is displayed as…
Zlowbro
  • 41
  • 3
1
vote
2 answers

Django medias(pictures) suddenly not loading

I am developing a website with Django, I had a lot of pictures in my project, uploaded from the admin panel and saved in the Media folder which I created for these uploads separately, It was working fine and exact way I wanted in months, Suddenly…
itsdiy0
  • 13
  • 3
1
vote
0 answers

Imported images in csv file not working in webpage

I imported a CSV file with multiple columns, one of them is for images and it's in this format
Everything works when I…
TheNerdy97
  • 23
  • 4
1
vote
1 answer

Using upload_to with STATICFILES_DIRS

Is it necessary to appoint MEDIA_ROOT, if indicated STATICFILES_DIRS? This issue arose when loading images - upload_to formed using MEDIA_ROOT and ignores STATICFILES_DIRS. If actually did not necessarily how to use upload_to with STATICFILES_DIRS?
I159
  • 29,741
  • 31
  • 97
  • 132
1
vote
0 answers

Django Media S3 - Model.get_queryset is accessing S3?

I have MEDIA files stored in S3 bucket and I noticed that REST API responses are very slow. What I also noticed is that Django tries to access the S3 when I do Model.objects.all(). Why it does that? Doesn't it store the URL in the database so it…
Milano
  • 18,048
  • 37
  • 153
  • 353
1
vote
1 answer

Django Get image from s3 bucket if image source is stored in a database

I have a model where users upload pictures to an s3 bucket. class Curso(models.Model): titulo = models.TextField() foto = models.ImageField(upload_to='media/cursos') #this goes to mybucket/media/cursos alt = models.TextField() …
pauzca
  • 164
  • 1
  • 12
1
vote
0 answers

django data shows all but images

My product card: product name and price shows but not image {product.name}
HelpANoobOut
  • 213
  • 1
  • 5
  • 11
1
vote
1 answer

Django reads images without defining MEDIA_URL

I'm new to Django, I know that to display an image I should define MEDIA_URL in the settings. But when I tried to remove it and use the {{ img.url }} the images are still readable and the browser can see it and display it. The question is does this…
Omar Abdelaziz
  • 477
  • 1
  • 6
  • 16
1
vote
1 answer

Django media files not loading when debug is False on Cpanel

I am trying to show my media files for over a week and tried all stackoverflow solutions yet nothing. My project is hosted on Cpanel, i tried giving the media the absolute path, tried to put them on the public_html folder, nothing. Plus my static…
Moon Days
  • 19
  • 3
1
vote
1 answer

How do I use product image in html background url of a div?. Django

I don't know how I can display a product-image inside my template. The image needs to go inside a background-url of a div, using static isn't a option, cause then its not coming form models. Html .... {% if products %} {% for product in…
Gin
  • 11
  • 3
1
vote
1 answer

Not showing Media images in Django however Static files work

I am out of my depth and would like to ask you about my challenge with some images that won't load on my project. Images and CSS from the static folder get loaded successfully. But my images from the media folder are what is not showing up with…
1
vote
1 answer

Django media image displays blank box

Hi I'm trying to display an uploaded user image in django but when I try to display it only a blank box appears. However when I click on the image it brings up a new page with the image. I don't know why it isn't displaying on the page. html {% load…
callison98
  • 11
  • 1
1
vote
0 answers

Django/wsgi not serving media files properly

I'm developing a small web GIS app with Django just for demo purposes. Everything works fine with static and media files when debug=True, but when I set debug to False in production and want to serve static and media files through the web server…
trideset3
  • 85
  • 8
1
vote
1 answer

Do I need to write the full media path in Django?

I am trying to download a file that is stored in the media folder and it seems as it only works when I am writing the full path as: file_location = '/home/user/user.pythonanywhere.com/media/' In the settings page on pythonanywhere, the 'media url'…
Peter
  • 43
  • 6
1
vote
1 answer

Separate media settings for each app in django

I am working on building a django based blog-like site, it currently has one app. It contains a media folder which contains the images uploaded by the user. However, the MEDIA_URL and MEDIA_ROOT are specified in the main settings.py file. But in…
user12536200