Hi,
I followed those steps in the link and its working fine for static files (like css scripts etc). But when i'm trying to display an image, its not working. I'm trying to display an image which is in static/barcodeimages directory (static is the directory to which i set all static files should be served). So when i try <img src = {{ imagepath }}> {{ imagepath }} where imagepath = "/barcodeimages/image.png" its not working On May 17, 4:11 am, Daniel Roseman <roseman.dan...@googlemail.com> wrote: > On May 16, 9:19 pm, newbie <mara.ku...@gmail.com> wrote: > > > Hi, > > > Thanks for your immediate reply. I've seen the document and > > followed the steps in it already. But was not able achieve any > > progress. In > > > (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', > > {'document_root': '/path/to/media'}), > > > does site_media mean the directory in which the template exists or the > > url of the template according to the urls.py file > > Er, neither. It refers to the document where your media lives. > Probably the same as MEDIA_ROOT in your settings.py. > > > > > Actually i have a form in the > > urlhttp://127.0.0.1:8000/identity/franchisebook. > > Once the user fills the form, in the franchisebook function, I'm > > redirecting the variables into a print.html file through > > render_to_response(). And i want to display an image in that file. > > This print.html resides in templates directory(of course all templates > > are in "templates" directory). Below are some things I've tried out > > > (r'^identity/franchisebook/(?P<path>.*)$', > > 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), > > (r'^identity/(?P<path>.*)$', 'django.views.static.serve', > > {'document_root': settings.MEDIA_ROOT}), > > (r'^identity/print.html/(?P<path>.*)$', 'django.views.static.serve', > > {'document_root': settings.MEDIA_ROOT}), > > (r'^identity/franchisebook/print.html/(?P<path>.*)$', > > 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), > > > So what do i have to specify in the place of site_media? I have tried > > all the possible replacemetns. But i was not able to achieve any > > progress. Please help me out. > > I don't understand why you want to specify anything instead of > site_media. That's just a URL, and your urls.py is mapping it to a > particular place on the disk - ie where your media files are saved. > There's no reason to start putting references to your template there. > -- > DR. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---