All,
I've started this question (http://stackoverflow.com/questions/5016864/include-image-files-in-django-templates-shows-broken-link) with several helpful anserws but somehow this still doesn't resolve my trouble. Therefore i try posting my code and hopefully someone is able to tell me whats going wrong.. I seem to miss something but don't see what:
in settings.py :
MEDIA_ROOT = 'C:/Users/Tijl/Documents/Programming/Dashboard/src/DashboardDesign/FigureOnWebSite/templates/images/static'
MEDIA_URL = 'http://localhost:8000/static/'
In urls.py:
(r'^Point3D/graphics/$', 'FigureOnWebSite.views.graphics'),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
in views.py:
> def graphics(request):
> laptop = "laptop.jpg"
> t = loader.get_template('FigureOnWebSite/templates/Figure.html')
> c = Context({'picture': laptop})
> return HttpResponse(t.render(c))
in my Figure.htm;
<img src"{{picture}}" alt = "picture"/>
it shows a broken link image and if i right click i can see the right source but still isn't displaying it the link is:
http://127.0.0.1:8000/Point3D/graphics/
the location of the file is in: C:\Users\Tijl\Documents\Programming\Dashboard\src\DashboardDesign\FigureOnWebSite\templates\images
If I change Figure.html to;
{{picture}}
it shows laptop.txt on http://127.0.0.1:8000/Point3D/graphics/
Hopefully the above is enough for someone to help me out.
Thanks alot! Tijl