Questions tagged [django-media]

237 questions
0
votes
0 answers

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 server. In my project, I have Product model and…
bailofwZ
  • 123
  • 1
  • 10
0
votes
0 answers

Change the location of a file uploaded via HTML form on submit

I have a form that asks for various inputs one of which is a file input. I want the uploaded files to be stored inside /media/images which is the case when I upload files from the admin console since I specified the upload location in models.py. How…
0
votes
0 answers

media files are autmoatically deleted django deployment

i am deploying the code in jenkins server after checkeing in server ip existing media images are not displayed and update code changes perfectly working and upload new images displayed but old images are not displayed. please can you give me…
0
votes
0 answers

permission for show media folder images in django, python

I want set permission for show media folder images. for example, I want show my images to users who are staff. When user in not staff, show 404 Error. Thanks
0
votes
1 answer

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 images there. my models.py : class…
0
votes
1 answer

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". And then once the file uploaded successfully run button…
0
votes
0 answers

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, and image exsists and can be loaded. As you can…
vadim
  • 1
  • 1
0
votes
1 answer

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 this article but still didn't get what i want…
skay138
  • 3
  • 1
0
votes
1 answer

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 = models.CharField(max_length=20) emp_role =…
0
votes
1 answer

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, for examaple: Issue with image in django But…
0
votes
0 answers

how to store django static and media files on client virtual machine

i have a requirement to separate application server and datbase server such that the data resides with client and application will be hosted by the company where i work. The problem here is how do i store the media file uploaded by client in some…
0
votes
0 answers

How to Secure Django Media Files in Production

In my localhost server, I was able to restrict users from accessing pdf media files which they are not supposed to access given that they are not the uploader of the file or the admin of the system. The problem is that when I tried to deploy my…
prinxx
  • 1
  • 3
0
votes
0 answers

how to pass a django variable of an object fetched from the database in css

I want a background image to be an image uploaded by a user. what tryed:
0
votes
0 answers

Media folder not working properly & Images not being saved - Django

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, 'media') root_directory/urls.py: from…
0
votes
1 answer

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, blank=True) slug =…