according to the link http://docs.djangoproject.com/en/dev/howto/static-files/ site_media is the URL where your media will be rooted and The file / path/to/media/foo.jpg will be made available at the URL /site_media/ foo.jpg.
so i thought the file which is at ~/../djcode/myproject/static/pic.jpg shd be available in template ~/../djcode/myproject/app/templates/ print.html file. So accordingly the value of site_media should be the directory where the template resides, that was what i thought. So you mean that site_media should be the directory where static files of the project reside,( i.e., static in my case )and path/to/media shoud be the total path to the place where the media lies (which is also the same in my case). This is quite a silly doubt, but sorry for the trouble, I'm still a novice and not acquainted with the django conventions. 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 -~----------~----~----~----~------~----~------~--~---