404 error on /admin/blog/post
I got virtually to the end and everything seemed to be working fine and now I am getting a 404 error (both locally and on Heroku) when I try to go to Posts from the admin. It was working earlier but now no.
Everything else seems to work fine and I checked my code against the Github repo but I can't see the problem.
Any hints on where I might look?
Answers
Hello Kenneth,
Here is the code for microblog/urls.py :
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from . import views
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', views.HomepageView.as_view(), name="home"),
url(r'blog/', include("blog.urls", namespace="blog")),
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += patterns('',
(r'^static/(.*)$', 'django.views.static.serve', {
'document_root': settings.STATIC_ROOT
}),
)
and the code for blog/urls.py
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^$', views.PostListView.as_view(), name="list"),
url(r'(?P<slug>[\w-]+)/$', views.PostDetailView.as_view(), name="detail"),
)
Update: when I click on Blog on the Admin page, I am taken to http://127.0.0.1:8888/admin/blog/ and this is displaying the blog_list page (i.e., identical to http://127.0.0.1:8888/blog/), not an admin page as I would expect.
I am using Django 1.5 but I wouldn't expect that to make a difference here. I've gone line by line and checked my code against the Github repo and see no differences. I'm stumped.