views:

37

answers:

1

Howdy,

I have got the following file heirarchy:

project
  other stuff
  templates
      images
          images for site
      app1
          templates for app1
      registration
          login template
      base.html (base for entire site)
      style.css (for base.html)

In the login template, I am extending 'base.html.' 'base.html' uses 'style.css' along with all of the images in the 'templates/images' directory. For some reason, none of the CSS styles or images will show up in the login template, even though I'm extending it.

Does this missing image issue have something to do with screwed up "media" settings somewhere? I never understood those, but this is a major roadblock in my proof-of-concept, so any help is appreciated.

Thanks!

+3  A: 

I recommend not putting the styles and images there. For development, your MEDIA_ROOT may point to an arbitrary local directory on your machine containing the files, it need not even be below your django project's root folder (see http://docs.djangoproject.com/en/dev/ref/settings/#media-root).

For production, you'll have to choose a different approach to serving static content anyway (http://docs.djangoproject.com/en/dev/howto/static-files/#the-big-fat-disclaimer).

jellybean
So what do I put in my <img src="..."> to get my logo to appaer?
Whatever you specified as `MEDIA_URL` plus the remaining path to your file.
jellybean
Alright, I still can't get it to work. Here are my exact settings: MEDIA_ROOT = '/home/tyler/Documents/cartographer/media/' MEDIA_URL = 'http://localhost:8000/media/' in urls.py: (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/tyler/Documents/cartographer/media/'}),<img src="http://localhost:8000/media/images/logo.png">The url on my computer is: /home/tyler/Documents/cartographer/media/images/logo.png.
Figured it out. Conflict with Admin and Regular media root...
@user367817: "I still can't get it to work..." Then UPDATE the question. Don't post long bits of code in comments. UPDATE your question with this revision.
S.Lott