Hi Michael, Believe me, I've read the documentation, and I had already tried specifying the images folder as path to media instead of the parent of images, public.
Any way, here is my current urls.py document: from django.conf.urls.defaults import * from django.conf import settings from btaylor_design.views import home urlpatterns = patterns('', (r'', home), ) if settings.DEBUG: urlpatterns += patterns('', (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/Users/bt/django_projects/btaylor_design/ images'}), ) I am using the .96 release, and the above is verbatim according to the documentation for .96, available at: http://www.djangoproject.com/documentation/0.96/static_files/ So, according to the docs, I should be able to set the src of an image tag to: <img src="/site_media/my_image.jpg" /> When I run the following from the command line: cd ~/django_projects/btaylor_design python manage.py runserver 8080 and go to: http://127.0.0.1:8080 I get a big fat question mark where my image should be. I followed the exact instructions, and again, it doesn't work. I can't explain why. I have verified that the image exists at the folder specified at '/Users/bt/django_projects/images/my_image.jpg'. Here is the tail from the server: Django version 0.96, using settings 'btaylor_design.settings' Development server is running at http://127.0.0.1:8080/ Quit the server with CONTROL-C. [09/Feb/2008 11:58:42] "GET / HTTP/1.1" 200 39 [09/Feb/2008 11:58:42] "GET /site_media/my_image.jpg HTTP/1.1" 200 39 Ideas? Thank you, Brandon On Feb 9, 10:59 am, Michael Hipp <[EMAIL PROTECTED]> wrote: > Brandon Taylor wrote: > > Hi everyone, > > > I'm just about to give up on Django. I can't even get it to load a > > simple jpeg using the built-in server. > > > Here is my directory structure: > > > '/Users/bt/django_projects' is where all of my Django projects exist > > > /btaylor_design > > settings.py, etc > > /public > > /images > > /stylesheets > > /javascript > > > In my urls.py, I have the following: > > > from django.conf.urls.defaults import * > > from django.conf import settings > > from btaylor_design.views import home > > > urlpatterns = patterns('', > > (r'', home), > > > # Uncomment this for admin: > > #(r'^admin/', include('django.contrib.admin.urls')), > > ) > > > if settings.DEBUG: > > urlpatterns += patterns('django.views', > > (r'^public/(.*)$', 'static.serve', > > {'document_root': '/Users/bt/django_projects/btaylor_design/public'}), > > ) > > > Can ANYONE give me a definitive answer on why this thing won't load so > > much as a simple image, with a src set to: <img src="/public/images/ > > some_image.jpg /> ???!!! > > > Many thanks in advance to any kind soul who would take the time to > > help me. I've struggled with this thing, trying many variations from > > posts from this group for a couple of days, so it's not as if I'm just > > throwing my hands up at the first error. I've been doing web for a > > long time, and see a lot of promise in this framework - if I can get > > it to work! > > Brandon, > > I'm a total noob to Django (about two weeks of an hour here and there) > but I haven't had anywhere near the problems you're having... > > because I FOLLOWED THE DIRECTIONS. > > Took me 5 seconds of googling to find the answer to your question: > > http://www.google.com/search?hl=en&client=firefox-a&channel=s&rls=org... > > http://www.djangoproject.com/documentation/static_files/ > > You have the document root thing set to public rather than > public/images. The instructions clearly say '/path/to/media', not > /path/to/doc/root > > here's mine: > > if settings.DEBUG: > urlpatterns += patterns('', > (r'^images/(?P<path>.*)$', 'django.views.static.serve', > {'document_root': 'c:/projects/djcode/reports/images'}), > (r'^css/(?P<path>.*)$', 'django.views.static.serve', > {'document_root': 'c:/projects/djcode/reports/css'}), > ) > > This isn't hard, but helps when you get started to follow the directions > *exactly* until it's working, then try customizing things to suit your > needs/tastes. > > Michael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---