简体   繁体   English

Django 404-URLs.py

[英]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. 我认为我的URLs.py文件是唯一重要的文件,但是如果您需要更多文件,请告诉我。 When I go to localhost:8000/notendur/ I get a 404 error. 当我转到localhost:8000 / notendur /时,出现404错误。 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 notendur/urls.py

it should be 它应该是

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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