On Tue, Apr 3, 2012 at 1:14 AM, Homer <hi...@foxmail.com> 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), > ) >
You have conflicting URL space, you have configured "^cn/" to be both where your static files are served from, and also where your views are served from. Split the two up, and use the correct URL, and you should not have any problems. Eg: urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^photos/', include('final.photo.urls')), url(r'^docs/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ) I'm not sure why people are interested in your TEMPLATE_CONTEXT_PROCESSORS settings when the request isn't even making it to the view... Cheers Tom -- 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.