Форум сайта python.su
Доброго времени суток!
Выполняю пример из главы 2.
В админку заходит нормально, но когда дело доходит до блога, выдает следующий выхлоп:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/blog
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^blog/
^admin/doc/
^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 page.
Пример выполнил один-в-один как в книге, проверил все 10 раз. Что не так, может быть в книге опечатка.
На всякий привожу содержимое файла mysite\urls.py
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', ‘mysite.views.home’, name='home'),
url(r'^blog/', include('mysite.blog.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
)
и файла \mysite\blog\urls.py
from django.conf.urls.defaults import *
from mysite.blog.views import archive
urlpatterns = patterns('',
url('r^$', archive),
)
Офлайн
petryk
оффтоп: оборачивайте код в теги code в квадратных скобках
Вы вообще читали что вам пишут то?
Вам сообщили:
petrykт.е. у вас в файле urls.py нету совпадения с запросом.
The current URL, blog, didn't match any of these.
petrykА надо так:
url('r^$', archive),
url(r'^$', archive),
Офлайн
Спасибо.
Офлайн