Questions tagged [django-media]
237 questions
4
votes
1 answer
django admin static files stopped working after upgrade to 1.4
Setting up static files in django has always been a nightmare to me. When it comes to dealing with django static content I get depressed and feel dumb and stupid. I never really cared about getting admin media files served as static ones since I…

abolotnov
- 4,282
- 9
- 56
- 88
4
votes
1 answer
Django - how to store ImageField files in different folders?
I've configured both MEDIA_ROOT and MEDIA_URL and this works perfectly fine.
My MEDIA files stored in a directory named /media/, now I want to store newly uploaded files to a new directory (for ex. /media2/) without breaking previous files.
For…

Omid Adib
- 170
- 1
- 8
4
votes
3 answers
Using only gunicorn, django, and whitenoise how do I serve media?
I have my website finally working properly, but media files aren't served when debug = False what should I do? I've went through hell trying to make it work with nginx following this tutorial but it kept breaking and not serving static among other…
user12207810
4
votes
1 answer
Django. Media Files not found
Ok, I have a Django 1.10 project. The relevant settings look like this:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = BASE_DIR + "/media/"
MEDIA_URL = '/media/'
I'm working locally, I can upload images…

Alejandro Veintimilla
- 10,743
- 23
- 91
- 180
4
votes
1 answer
How to define inline Javascript to be rendered for a Django form/widget/admin?
It is well documented how to add an external ressource file to be included by a page containing a Django form (or widget, or admin): defining a nested Media class with js or css members listing the approriate files.
This has the effect of adding…

Ad N
- 7,930
- 6
- 36
- 80
4
votes
1 answer
Django media URL not found
I'm running into a strange issue,hope some where else some one can had faced the same problem.My problem which is like, the stored media in django application are not able to serve through MEDIA_ROOT URL.When I tried to get list of media files that…

Ramakrishna
- 686
- 1
- 12
- 25
3
votes
2 answers
Django nginx admin media
I am currently testing moving from Apache mod_wsgi to Nginx and FastCGI
I have prepared the whole installation and currently testing it on a CentOS 5.4 box that runs Django 1.1.2
In my old Apache configuration I had and alias setup for /media/ and…

ApPeL
- 4,801
- 9
- 47
- 84
3
votes
1 answer
DJANGO media images not showing
Hello I am trying to display an image from
media/images
On my html I have this code:
index.html
{% extends 'basic_app/base.html' %}
{% block metablock %}
CBV - Index
{% endblock metablock %}
{% block bodyblock %}

Jose Alberto
- 31
- 2
3
votes
1 answer
Django MEDIA_URL returns http instead of https
I'm using Django 2.2.x and DRF.
I have a model with FileField
file = models.FileField(upload_to=get_media_upload_path)
Files are uploading but on access the obj.file, it gives URL without HTTPS
http://example.com/media/image.jpg
I want it to…

Anuj TBE
- 9,198
- 27
- 136
- 285
3
votes
1 answer
django 1.10 media images don't show
I have had django media images working in an existing django 1.7 project by adding the following to site urls.py:
urlpatterns = patters(
url(r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT,…

Atma
- 29,141
- 56
- 198
- 299
3
votes
1 answer
How to externalize Django's Media Data and Serve it to the Frontend
i'm building a restful web service with Django as the backend and am currently concerned with scaling.
I want to have an architecure like this: http://www.djangobook.com/en/2.0/_images/scaling-4.png
where i can just start up more django instances…

Jonas Kreusch
- 316
- 1
- 15
2
votes
1 answer
How to Scale images in Django
Background:
I have to upload images from users.
Problem:
The images need to be re-sized so that I don't end up with huge images on my disk. This re-sizing should happen just after the image is saved.
I have checked the following code
Django…

Akash Deshpande
- 2,583
- 10
- 41
- 82
2
votes
0 answers
How to pass an InMemoryUploadedFile in django to sqlite database with raw sql?
I can't figure out how to upload an image file in the database per Django rules. I added media roots and media URLs too in my settings.py. I get the error which says:
can only concatenate str (not "InMemoryUploadedFile") to str
This is clearly…

farhan
- 33
- 4
2
votes
1 answer
Django: how to upload media files to different folders?
I want to save file in automatically created folder related with Employee id_number like:
media->employee->attachments->emp001->emp001.pdf
models.py
from django.db import models
class Employee(models.Model):
id_number =…

Sandun Tharaka
- 23
- 3
2
votes
2 answers
Django - Accessing static/media files always from a remote MEDIA_URL instead of local one during development
I have a Django app running on a server and I would like to continue working on it locally with the runserver command. My problem concern the use of common static and media files. The media folder content changing frequently in production I have to…

Thomas
- 101
- 2
- 7