I am new to Django and I am trying to learn it through a simple project that I am developing under the name of "dubliners" and an application called "book". The directory structure looks like this:
dubliners/book/ [includes models.py, views.py, etc.] dubliners/templates/book/
I have a jpg file that should appear in the title of each web page. Where should I store the file? Which way should I use for a tag to display it using a template? I tried different places and paths, but so far nothing is working.
...
Thanks for the answer below. However, I tried both relative and absolute paths to the image, and I still get the broken image icon displayed on the web page. For example, if I have an image in my home directory and use this tag in my template:
<img src="/home/tony/london.jpg" />
Image is not displayed. However, if I save the web page as a static HTML file, the images are displayed, so the path is correct. Maybe the default web server that comes with Django will only display images if they are on a specific path?
python django django-templates
Tony May 23 '09 at 1:45 p.m. 2009-05-23 13:45
source share