how to use media, images not showing
Hello,
In my model, I have
image_path = models.FileField(max_length=128, upload_to='staff')
in index.html I have
<img src='{{ MEDIA_URL }}staff/{{ row.image_path }}' />
In settings I have
DIR = os.path.abspath(os.path.dirname(__name__))
MEDIA_ROOT = os.path.join(DIR,'media')
MEDIA_URL = 'http://127.0.0.1/media/'
media_url prints out as http://127.0.0.1/media/
store
media
staff
inage1.jpg...
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/cjexEuGa4jkJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home