Not found media/some.jpg

24 views
Skip to first unread message

Salima Begum

unread,
Jul 21, 2020, 10:56:35 PM7/21/20
to django...@googlegroups.com
Hi all,
Here, i am using three image fields in PostAd form. Images are not saved to the media folder. Can anyone help me please.

In models.py
class classifieds(models.Model):
title = models.CharField(max_length=60)
description = models.CharField(max_length=600)
price = models.IntegerField()
image = models.ImageField(
upload_to='photo/', null=True, blank=True)
image2 = models.ImageField(upload_to='photo/', null=True, blank=True)
image3 = models.ImageField(upload_to='photo/', null=True, blank=True)
added_date = models.DateTimeField(editable=False)
modified_date = models.DateTimeField()

In settings.py:
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
MEDIA_URL =
'/media/'
In urls.py(project urls):
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
In views.py:
snippet of views.py
if request.method == 'POST':
title = request.POST['title']
description = request.POST['description']
price = request.POST['price']
image = request.POST['image']
image1 = request.POST['image1']
image2 = request.POST['image2']
I am getting this error 
Thanks in advance

media.PNG

Exactly musty

unread,
Jul 21, 2020, 11:32:32 PM7/21/20
to Django users
delete the media folder and add image again from your admin

Mangal Is Back

unread,
Jul 22, 2020, 3:32:24 PM7/22/20
to django...@googlegroups.com
there is a person who do not want that i could help you
Sorrry

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/70cd5015-b614-4d58-9a94-3bfe5818630bo%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages