--
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...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Best Regards,Stanwin Siow
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
TEMPLATE_CONTEXT_PROCESSORS
Has this file
'django.core.context_processors.static',
2012/4/3 Homer <hi...@foxmail.com>:
>> django-users...@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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
)
You have problem without 'django.core.context_processors.media'
with media content , take a look at
https://docs.djangoproject.com/en/dev/howto/static-files/
2012/4/3 Homer <hi...@foxmail.com>:
>> >> django-users...@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 view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>> >
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users...@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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/70nj8U1BxCoJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@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 view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>> >
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/70nj8U1BxCoJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
2012/4/3 Homer <hi...@foxmail.com>:
>> >> >> django-users...@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 view this discussion on the web visit
>> >> > https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>> >> >
>> >> > To post to this group, send email to django...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > django-users...@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 view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/70nj8U1BxCoJ.
>> >
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users...@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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/VqmbjpUWJpMJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
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
> 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?
I am positive the problem is with your URL patterns:
> # urls.py
> urlpatterns = patterns('',
> …
> url(r'^cn/', include('final.photo.urls')),
> url(r'^cn/(?P<path>.*)$', 'django.views.static.serve',
> {'document_root': settings.MEDIA_ROOT}),
> )
>
> # photo/urls.py
> urlpatterns = patterns('',
> url(r'^$', List),
> url(r'^/bedroom/', Detail),
> )
Trying to access 'cn/bedroom' _should_ redirect to view Detail, I guess.
But what happens is that 'cn/' gets stripped via the main level pattern,
including 'final.photo.urls'. There no match is found due to the leading
'/' in the second pattern: r'^/bedroom/'. Thus the search continues with
'cn/(?P<path>.*)$' in the top-level URL patterns which tries to access a
non-existing media file in settings.MEDIA_ROOT.
Therefore, to fix the issue, you should remove the leading forward slash
'/' in the second pattern in your photo/urls.py.
For reference, see the notes section in
https://docs.djangoproject.com/en/1.4/topics/http/urls/#example
– "There's no need to add a leading slash, because every URL has that.
For example, it's ^articles, not ^/articles."
Best wishes,
Sebastian.
>> >> >> 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 view this discussion on the web visit
>> >> > https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>> >> >
>> >> > To post to this group, send email to django...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > 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 view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/70nj8U1BxCoJ.
>> >
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/VqmbjpUWJpMJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
>> >> >> 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 view this discussion on the web visit
>> >> > https://groups.google.com/d/msg/django-users/-/Os90mGtKgrIJ.
>> >> >
>> >> > To post to this group, send email to django...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > 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 view this discussion on the web visit
>> > https://groups.google.com/d/msg/django-users/-/70nj8U1BxCoJ.
>> >
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/VqmbjpUWJpMJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to