1👍
✅
you shoud define MEDIA_ROOT in your settings file:
MEDIA_ROOT = (os.path.join(os.path.dirname(__file__), '..', 'appl_name/Static').replace('\\', '/'))
your images must be in appl_name/Static/Pictures/ dir
you template should look like this:
{% load staticfiles %}
<img src = {% static 'Pictures/teste.jpg' %} />
0👍
In your base folder for your django project you usually want to have a “media” or “static” folder. Here you will save your images. Then in settings.py define STATIC_ROOT = ‘static’ . define STATIC_URL = ‘/static/’ . and finally in your HTML IMG tag define it as such <img src="{% STATIC_URL %}example_image.jpg >
. that should work n fix ur image problem.
- [Answer]-Django CreateView Auto Login
- [Answer]-How to set 'next' parameter via extra_context in Django
- [Answer]-Django View Testing Assertion Error
- [Answer]-Using Django Q objects in *__lte keywords
- [Answer]-Python manage.py runserver causes AppRegistryNotReady exception with views that extend ProtectedResourceView
Source:stackexchange.com