Thanks for your reply, Keith. I have made your suggested changes, but unfortunately I still cannot display images.
On a whim, I put an image file in C:\Python25\Lib\site-packages\django/ contrib/admin/media\img02.jpg and used the following code in my template: <img src="/media/img02.jpg" The image now displays. It seems that it is not accessing my designated media directory. I read in the Django docs that MEDIA_URL and ADMIN_MEDIA_PREFIX cannot both be the same URL (as in, they cannot both say '/media/'). Could this be the problem? All settings are currently exactly as you outlined above. Kind regards, Robert On Oct 9, 1:45 pm, "Keith Eberle" <[EMAIL PROTECTED]> wrote: > you need to change these: > > #from settings.py > MEDIA_ROOT = 'D:/workspace/isiscore/media/' > MEDIA_URL = '/site_media/' > ADMIN_MEDIA_PREFIX = '/media/' > > #from urls.py > from django.conf import settings > (r'^media/(?P<path>.*)$', 'django.views.static.serve', > { 'document_root': settings.MEDIA_URL, 'show_indexes': > True, }), > > remember, MEDIA_URL, is a URL, not a filesystem path. > > keith > > On Thu, Oct 9, 2008 at 3:34 PM, Robert > <[EMAIL PROTECTED]>wrote: > > > > > I'm hoping I've just missed a simple switch, but I'm trying to get > > some simple CSS and images set up using the development server. > > > First, my setup: > > > from urls.py > > (r'^media/(?P<path>.*)$', 'django.views.static.serve', > > { 'document_root': 'D:/workspace/isiscore/media', 'show_indexes': > > True, }), > > > from settings.py > > > MEDIA_ROOT = 'D:/workspace/isiscore/media/' > > MEDIA_URL = 'D:/workspace/isiscore/media/' > > ADMIN_MEDIA_PREFIX = '/media/' > > > I have tried putting an image into my template with: src="css/images/ > > img02.jpg" but nothing happens. The full path to the image file is D: > > \workspace\isiscore\media\css\images\img02.jpg. > > > The Problem: > > > When I try to load css (in my template as <link rel="stylesheet" > > type="text/css" href="{{ MEDIA_URL }}css/default.css" />), nothing > > happens. > > > When I set the browser tohttp://127.0.0.1:8000/media/css/images/img02.jpg > > , > > I get a blank white page with the text "Page not found: C:\Python25\Lib > > \site-packages\django/contrib/admin/media\css/images/img02.jpg" at the > > top. It doesn't seem like the development server is even looking in > > the correct place. I'm also concerned by the seemingly random > > assortment of backwards and forward slashes. > > > I'll mention this because it may be important, but I'm also getting a > > "TemplateSyntaxError: Caught an exception while rendering: nothing to > > repeat" whenever I save a file and then reload a page. Everything > > works correctly, however, when I reload again. > > > Any and all help is kindly appreciated. > > > Kind regards, > > Robert > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---