235 questions
0
votes
0
answers
75
views
Django File Upload Not Working: Media File Missing and Full Path Issue
I'm working on a Django project where I'm trying to handle file uploads, but I'm encountering some issues. The uploaded files are missing, and I don't have the full path to the media files. Here's ...
0
votes
1
answer
55
views
How can I show my Image in my web site using django
I tried to show an image on my web, which I uploaded from the admin panel hand by using Django.
I was expecting to see my image on the web site, but instead it only showed the little img icon, and ...
0
votes
1
answer
50
views
Uploaded media doesn't server in production mode without restarting django
I need to serve media in Django in production mode and it is very little need to serve telegram user photos in Django admin. so I know everything about Django it's not for serving files or media so ...
1
vote
1
answer
76
views
I am having an issue uploading an image with Django
I am currently working my way through a django project and am having trouble working with MEDIA and uploading an graph image.
Inside settings.py, I have added the below code.
MEDIA_URL = '/media/'
...
0
votes
1
answer
57
views
Django FileField: File not uploading in media folder or sql database
I'm doing a e-learning portal using Django. The user 'teacher' should be able to upload files under any course. However, the files are not being upload in media/course_materials folder. When i check ...
2
votes
3
answers
1k
views
DEBUG=False is not showing static and media files in Django project on Cpanel
I've looked into many articles and videos on this topic, but either I didn't understand or the solutions were insufficient. I would be very happy if you could help. I developed a Django project and ...
-1
votes
1
answer
40
views
why django not able to pic or get uploaded images from database?
What i want is that when user fills up the registration form and upload his pic , in want that pic to be show on index.html page but its not showing up there so please help me guys
all the images are ...
0
votes
1
answer
220
views
How to fix 500 error when posting media files through django form on production
I am stuck with a server 500 server error at a form only when it is about to save the pictures (the rest of the forms belonging to other models are saved in the db ok)
I didn't have the problem in ...
0
votes
2
answers
35
views
How to fix 404 not found when I send POST method
I am trying to send POST to my database through POSTMAN and I get 404 not Found status. Here is my views and urls.
#views
`class PlantViewSet(ModelViewSet):
queryset = Plant.objects.all()
...
0
votes
1
answer
66
views
Attempting to migrate an Django ImageField, but failing to migrate
I am currently facing a problem with trying to migrate a Django Image field from a folder named media_root located inside a folder named static_cdn inside of my current project here is what my current ...
0
votes
1
answer
60
views
Django images don't show up on the web-site
settings.py
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
template
<img src="{{ group_avatar.avatar.url }}" style="width:30%" alt="Group Avatar" ...
1
vote
1
answer
105
views
Django How to download files from file system?
I'm trying to make a link to a file path on a Windows server downloadable to the user after they click the file link.
My app displays entries from a result of searching a ticket model. The results on ...
1
vote
2
answers
223
views
Django hide media files link for certain people
I programmed a function where you can download a file from the media folder with the media files depending on the link. The problem is that if you change the path in the link you have access to all ...
0
votes
1
answer
41
views
Can't show image from database in django
index.html
<img src="{{beat.image.url}}" class="card-img-top" alt="{{beat.name}}">
settings.py
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path....
0
votes
1
answer
195
views
Page not found (404) “/app/media/products/23/05/01/jeans.jpg” does not exist in django
Page not found (404)
“/app/media/products/23/05/01/jeans.jpg” does not exist while delpolying on railway
(as i have turned debug on for the exact error) .
i get this error when i am trying to open my ...
0
votes
2
answers
1k
views
Uploaded image via django admin not found, altough URL seems correct
as Django newby I am strugling to get an image on screen. After reading tons of questions and answers to problems alike, I am only more puzzled, because it looks like I coded the necesary, but I get ...
0
votes
0
answers
57
views
Django not displaying images which are in media folder?
In my django project I just want to plot some image which are there in my media folder. Eventhough the path I am seding to my frontend exists and I have verified multiple times if the path is correct. ...
0
votes
1
answer
114
views
Django Media-File Download-Link opening preview
I have a Django project in which I use wagtail. Now on one page, the user can upload an image and download it later. For the download link, I used following html:
<a href="{{file.document....
0
votes
1
answer
50
views
The photo uploaded by the user is not saved in the media directory
If I enter the image manually in the admin panel, it is correct, but if it is entered through the form, it is not saved in the media directory.
views.py
def profile_additional_info(request):
if ...
0
votes
1
answer
451
views
How to exclude media folder when deploying to railway
I have a django app hosted in railway, when I push the changes to github railway overrides the media folder as well and I lose all my images, is there a way to exclude the media folder from changing? (...
1
vote
1
answer
117
views
Function(instance, filename)
I,m working with my first project in Django, And I have a model like that:
def get_image_path(instance, filename):
category_name_path = instance.category.category_name
return f"{...
1
vote
0
answers
106
views
Django ImageField shows wrong url
I developed an e-commerce project, and now I am in the production phase in my own domain.
Everything works perfect in development server.
I'm using white-noise for serving static files in production ...
1
vote
2
answers
851
views
Django media file page not found
So, I'm trying to follow Django documentation about the static files and media files
I have a clean Django installation and I want to add the media folder. What I've done? I've changed the urls.py ...
0
votes
1
answer
54
views
Django - images upload in wrong folder
Making some kind of blog website and can't make homepage to show article images...
Images should be uploaded to media/profile_pics , but it just makes profile_pics folder in app folder and uploads ...
1
vote
0
answers
57
views
The media folder is not created after saving the file in the database Django
I`m writing a site on Django and I faced a problem. I have a cv field in the database, in which users can store their resume, I did everything as stated in the documentation. Namely:
Create FileField ...
0
votes
1
answer
244
views
File upload using Django framework
I need insights on how to upload a file on click of a save button.I have to upload a file and also capture user selections and save them(user selections) in a file when I click on "save". ...
0
votes
0
answers
245
views
Vue.js are not displaying images from Django media folder
So, i have up and running Django server on localhost. There's is a Vue page, whick is authorized and able to fetch models data.
If i inspect page, i see that img element have correctly resolved URL, ...
0
votes
1
answer
67
views
i can't display image on my Django admin page
i'm having trouble displaying images on my Djnago admin page.
i read https://stackoverflow.com/questions/2443752/how-to-display-uploaded-images-in-change-list-page-in-django-admin/51181825#51181825 ...
0
votes
1
answer
48
views
don't show images from ImageField in django template
Django doesn't show images from ImageField in a template.
models.py
class Employee(models.Model):
emp_name = models.CharField(max_length=200)
emp_email = models.EmailField()
emp_contact = ...
0
votes
1
answer
638
views
Django is showing me a 404 error instead of my image
my friends, this is my first question here.
So, I follow the Django documentation and some questions here, but the problem keep happening.
I did what was said on other similar questions, like this one,...
0
votes
0
answers
29
views
Media folder not working properly & Images not being saved - Django [duplicate]
I am trying to add images to a post. (Using Django v3.2.5)
root_directory/settings.py:
BASE_DIR = Path(__file__).resolve().parent.parent
...
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, '...
0
votes
1
answer
63
views
How can I store clone of the image to another model on Django
Does anyone know how to store a clone of the original image to another model on Django.
This is my models.py file
class blogs(models.Model)
title = models.CharField(max_length=100, null=True, ...
1
vote
0
answers
30
views
Django-filer problem when retrieve uploaded image in Django admin interface or any http|s request [duplicate]
I'm a noob in Django framework, sorry for misunderstanding in some concepts.
Currently, I'm trying to set up a Django app with django-filer. Django filer was installed commonly and migrations were ...
0
votes
3
answers
3k
views
Django images not showing up in template
I've spent the whole day trying to find a solution for showing the images in the template but I couldn't find any solution to my case.
This is my settings
STATIC_URL = '/static/'
MEDIA_URL = '/media/'...
0
votes
1
answer
57
views
how to serve a media file in Django?
I have a Django project where I'm trying to create a card with an image that was uploaded by the user. I keep getting a certain error but I have already done every solution and its still coming up. ...
0
votes
2
answers
3k
views
request media files in django when the debug is false [duplicate]
i tried to set media root and media url in but when the debug is false don't return anything
settings.py
...
DEBUG = False
ALLOWED_HOSTS = [
'127.0.0.1',
'0.0.0.0',
...
]
...
STATIC_URL = ...
0
votes
2
answers
322
views
Django Picture showing as broken when referenced in template
I am trying to create a settings page for user profiles and I have hit a roadblock. I included a profile image inside of my User model and when trying to reference said ImageField in my profile ...
1
vote
1
answer
1k
views
How to change media url in django while serving media files using apache2?
I have a website in production that serves media files properly.
Media Setting in settings.py file :
MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
I have created a media ...
0
votes
2
answers
2k
views
Django media url from model
I'm working on a simple blog, I have this model for the blog post:
class BlogPost(models.Model):
title = models.CharField(max_length=150, unique=True)
body = models.TextField()
cover_image ...
0
votes
0
answers
53
views
Django Static files Page not found (404)
I am trying to create a website using Django and in my models.py I am using Django's ImageField(upload_to=''), but these files are not being uploaded to their location and I don't know why. That file ...
1
vote
1
answer
196
views
Django can't acces media files, 404 Page not found
I recently started to learn Django but I'm still struggeling with accessing media files. My settings.py file includes the following:
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')...
2
votes
1
answer
2k
views
Nginx responds 404 not found on Django media URL in preprod, dev ok
I have a quite standard Django application with a Vuejs frontend.
I have different environments (preprod/dev) in which I have file upload/download features.
For files, everything works fine because ...
1
vote
0
answers
59
views
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 &...
1
vote
0
answers
130
views
Django media not loading. staticfiles works
Using Django, I've deployed my web app to http://159.223.177.51/. To login to see the images, use sof///stackoverflow123
I can see the custom fonts and CSS so I know static is working. However, none ...
1
vote
2
answers
589
views
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, ...
0
votes
0
answers
461
views
Django Static doesn't load but is accessible. NGINX and Docker
I have connected my Django (DRF) to Gunicorn and Nginx and put it all in docker.
When I load mysite.com/admin/ it looks bad, just plain text. So it seems like it does not load any static file. However,...
2
votes
1
answer
886
views
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
...
2
votes
2
answers
1k
views
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 ...
1
vote
2
answers
110
views
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 ...
0
votes
1
answer
44
views
Django doesn't load a default picture. I have MEDIA root connected to urls
So I want the imageField to load a default picture when one is not uploaded by user.
When I upload something in the imageField form, they end up in the correct folder. When I want it to load a default ...