It seems tha you are using blog// (two slashes) on the url. Try blog/ Sent from my iPhone
> On Jul 13, 2014, at 6:52, ngangsia akumbo <ngang...@gmail.com> wrote: > > > > Here is the similar probe > > views File > # Create your views here. > from blog.models import Post > from django.shortcuts import render_to_response > from django.template import RequestContext > > def news_index(request): > posts = Post.objects.all().order_by('published_date') > context = {'posts': posts} > return render_to_response('index.html', context, > context_instance=RequestContext(request)) > > > def news_detail(request, blogslug): > posts = Post.objects.get(slug=blogslug) > context = {'posts': posts} > return render_to_response('news_detail.html', context, > context_instance=RequestContext(request)) > > Model File > > from django.db import models > > # Create your models here. > > class Reporter(models.Model): > name = models.CharField(max_length=60, blank=True) > tell = models.IntegerField(blank=True, null=True) > location = models.CharField(max_length=50, blank=True, null=True) > address = models.TextField(max_length=250) > > > class Post(models.Model): > title = models.CharField(max_length=100) > slug = models.SlugField(unique=True) > published_date = models.DateTimeField(auto_now_add=True) > image = models.ImageField(upload_to='static/blog') > content = models.TextField() > repoter = models.ForeignKey(Reporter) > > > def __unicode__(self): > return self.title > > PROJECT/URLS > > from django.conf.urls import patterns, include, url > > #enable the admin: > from django.contrib import admin > admin.autodiscover() > > urlpatterns = patterns('', > > url(r'^blog/', include('blog.urls')), > url(r'^admin/', include(admin.site.urls)), > ) > > > APP/URL > from django.conf.urls import patterns, url > from blog import views > > urlpatterns = patterns('', > > url(r'^$', views.news_index, name='news_index'), > > WHEN I TYPE 127.0.0.1:8000/blog it outputs the first url in this file as a > series of links. > url(r'^(?P<blogslug>\d+)/$', views.news_detail, name='news_detail'), > When i clik on the links this second url breaks down, giving me the error > below > > ) > > > Page not found (404) > > Request Method: GET > Request URL: http://127.0.0.1:8000/blog// > Using the URLconf defined in rango.urls, Django tried these URL patterns, in > this order: > > ^blog/ ^$ [name='news_index'] > ^blog/ ^(?P<blogslug>\d+)/$ [name='news_detail'] > ^admin/ > The current URL, blog//, didn't match any of these. > > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a standard 404 pa > > > Please i really need help here > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/e7a715a2-252f-4db7-ad6d-ce1aa721916c%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2C3BF0E3-21B7-48D4-B6A7-9BF83EB7A4DC%40gmail.com. For more options, visit https://groups.google.com/d/optout.