Nope, that's not the problem.  I had read that page, and another that
suggested a slightly different syntax for the urlpatterns (from
http://rob.cogit8.org/blog).  Sorry that I forgot to mention that I
had already put Rob's version in my code -- I wasn't sure if it was
necessary simply to show any images anywhere on your site (the example
is of a set of images with a directory and links to each image).

This is what is currently in my urls.py file, after my other
urlpatterns (and yes, DEBUG is set to True):
if settings.DEBUG:
  urlpatterns += patterns('',
    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': os.path.join(settings.PROJECT_PATH, '..',
'media')}),
  )

That page in the docs doesn't say anything about how to call this from
the view.  Are these files automatically accessed by an <img> tag?  I
didn't see any special image tag (like the image_tag in rails) in the
template tags or in my search of the docs.
Thanks

On Jan 12, 1:43 pm, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On Jan 12, 6:35 pm, jazztpt <annacalla...@gmail.com> wrote:
>
>
>
> > I'm building my first django app and having a few problems in my dev
> > environment.  I have a couple of images that I want to use in my
> > base.html template.  I have tried various configurations, but none of
> > my images show up.  I've tried putting the images in /media, in /media/
> > img, and in the main project folder.  I have tried each of those paths
> > in my settings.py MEDIA_ROOT.  I have also tried importing os and
> > using relative paths in my settings.py file.  Here are some examples
> > of my settings:
>
> > # MEDIA_ROOT = '/Users/anna/Documents/Projects/autodiags/media/'
> > # IMAGE_ROOT = '/Users/anna/Documents/Projects/autodiags/media/img/'
> > MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media')
> > MEDIA_URL = 'http://autodiagnostics.com/media/'
>
> > In my templates I am trying to access these with a regular img tag:
> > <img src="/media/autodiag_title.jpg"/>
>
> > I have also tried src="/autodiag_title.jpg" and without the slash.
> > None of my images have ever shown up.  What am I doing wrong?
>
> > Thanks for your help!
>
> What you are doing wrong is failing to read the 
> documentation:http://docs.djangoproject.com/en/dev/howto/static-files/
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to