I add the section you provided to my settings.py but it still does not work...
在 2012年4月3日星期二UTC-4上午8时57分57秒,skhohlov写道: > > this section from my last project : > > > 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>: > > Sorry, I did not find "TEMPLATE_CONTEXT_PROCESSORS" in my settings.py. I > do > > not know whether it is related to the version of Django. I am using > Django > > 1.3 right now. > > > > 在 2012年4月3日星期二UTC-4上午2时20分30秒,skhohlov写道: > >> > >> please post section of the setting.py file > >> > >> TEMPLATE_CONTEXT_PROCESSORS > >> > >> Has this file > >> > >> 'django.core.context_processors.static', > >> > >> 2012/4/3 Homer <hi...@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+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 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+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 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-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 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-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.