check your Media_root in settings.py. It could be a missing stroke.
Best Regards, Stanwin Siow On Apr 3, 2012, at 8:14 AM, Homer wrote: > I met "404" page not found when I try to enter 127.0.0.1:8000/cn/bedroom . It > says on the webpage that "C:/Django/final/media/bedroom" does not exist". Why > would this happen? > > urls.py: > > from django.conf.urls.defaults import * > from final import settings > > from django.contrib import admin > > admin.autodiscover() > > urlpatterns = patterns('', > > url(r'^admin/', include(admin.site.urls)), > > url(r'^cn/', include('final.photo.urls')), > > url(r'^cn/(?P<path>.*)$', 'django.views.static.serve', > > {'document_root': settings.MEDIA_ROOT}), > > ) > photo/urls.py: > > from django.conf.urls.defaults import * > > from final.photo.views import List, Detail > > urlpatterns = patterns('', > > url(r'^$', List), > url(r'^/bedroom/', Detail), > > ) > > photo/views.py: > > > from django.template import loader, Context, RequestContext > > from django.http import HttpResponse > > from final.photo.models import Image, Audio, Pinyin, SImage > > from django.shortcuts import render_to_response > > def List(request): > > ShowSImage = SImage.objects.all() > ShowLink = Image.objects.all() > > context = RequestContext(request, { > > 'ShowSImage': ShowSImage, 'ShowLink': ShowLink > > }) > > return render_to_response('list.html', context) > > def Detail(request): > ShowImage = Image.objects.all() > ShowPinyin = Pinyin.objects.all() > ShowAudio = Audio.objects.all() > context = RequestContext(request, { > 'ShowAudio': ShowAudio, 'ShowImage': ShowImage, 'ShowPinyin': > ShowPinyin > }) > return render_to_response('detail.html', context) > detail.html: > > {% extends "base.html" %} > > {% block title %}{{ item.title }}{% endblock %} > > {% block content %} > > <h2>{{ item.title }}</h2> > <img src="{{ item.get_image_url }}" /> > {% if object.caption %}<p>{{ object.caption }}</p>{% endif %} > > {% endblock %} > Thanks in advance! > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/V1uKDrAvYS0J. > 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. -- 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.