Monday, May 31, 2021

After uploading image is not displaying in production server.

Hi all,
In my project after depl;oying into production server When i have uploaded images it saves into media folder but not displaying image in template. As well as when we go to the admin site and to display an image when I click on the url of the image it is throwing an error like. url not found.

But in the media folder the image is saved and when I double click on that image is opened. and when i upload an image from the admin site, the image is displayed in a template.

Actually in development server uploading displaying images is working good. After deploying into the production server I have this issue. Please help me to solve this issue.
 
**settings.py**
```
# managing media
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
```

Project urls.py

```
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
```

Thanks
~Salima

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMSz6bnWOOxOw0%2Bnt4RbOHEU_2zsbtHEg8Bs1aU32koX9Cgmow%40mail.gmail.com.

No comments:

Post a Comment