简体   繁体   中英

Django 404 - URLs.py

I think my URLs.py files are the only ones that matter but if you need more just let me know. When I go to localhost:8000/notendur/ I get a 404 error. It worked before, but, unfortunately, I can't remember what I of this I have changed. Error:

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'),
)

in notendur/urls.py

it should be

 url(r'^$', ..... instead of url(r'notendusr/^$'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM