我认为我的URLs.py文件是唯一重要的文件,但如果您需要更多信息,请告诉我。当我去localhost:8000 / notendur /我收到404错误。它以前工作过,但不幸的是,我无法记住我对此的改变。错误:
Page not found (404)
Request Method: GET
Request URL: http://localhost:8000/notendur/
Using the URLconf defined in tbg.urls, Django tried these URL patterns, in this order:
^$ ^notendur/$
^$ ^reikniverk/$
^notendur/
^admin/
The current URL, , didn't match any of these.
/ PROJECT:
tbg/urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'tbg.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
#url(r'^notendur/$', 'notendur.views.Info_view', name='Info_view'),
#url(r'^reikniverk/$', 'notendur.views.Reikniverk_view'),
url(r'^$', include('notendur.urls')),
url(r'^notendur/', include('notendur.urls')),
#url(r'^reikniverk/', include('reikniverk.urls')),
url(r'^admin/', include(admin.site.urls)),
)
/ APPLICATION:
notendur/urls.py
from django.conf.urls import patterns, url
from notendur.models import *
from django.views.generic import ListView
urlpatterns = patterns('',
url(r'^notendur/$', ListView.as_view(
queryset=Information.objects.all(),
template_name="notendur.html")),
url(r'^reikniverk/$', 'notendur.views.Reikniverk_view'),
)
答案 0 :(得分:2)
在notendur/urls.py
应该是
url(r'^$', ..... instead of url(r'notendusr/^$'