I've written a small project to upload and view images using a recent
development version of Django.  In settings.py, I've defined
MEDIA_ROOT = join(PATH, 'media') # the full path to the media
subdirectory of my project directory
MEDIA_URL = '/media/'
I've created subdirectories /media/images in my project directory.
I've defined my model with an ImageField(upload_to='images'), defined
a form with enctype="multipart/form-data/", etc.
When I create a new object with a selected image, the image is
correctly uploaded to /media/images/.  The HTML page intended to
display the image correctly (?) uses the following HTML element:
<img alt="images/foo.jpg" src="/media/images/foo.jpg" height="40"
width="100" />
The development server displays a message of the form:
[20/Sep/2011 14:35:04] "GET /media/images/foo.jpg HTTP/1.1" 404 2218
I.e., the image is not found and the rendered page contains only a
query where the image should be displayed.
So the images are being uploaded correctly, the generated HTML
contains <img> elements that refer to the correct locations of the
images, but they are not being displayed.  The image and its
containing directories are all world-readable.
So can someone please explain what else I have to do to make this
work?  Many thanks.
Rodney

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to