Monday, April 2, 2012

Re: Django: 404 page not found

please post section of the setting.py file

TEMPLATE_CONTEXT_PROCESSORS

Has this file

'django.core.context_processors.static',

2012/4/3 Homer <hi.cn@foxmail.com>:
> I think "media_root" works well since I also used pictures on my another
> page. Maybe there is something wrong in my urlconf...
>
> 在 2012年4月2日星期一UTC-4下午8时41分02秒,St@n写道:
>>
>> 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+unsubscribe@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-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate