Page not found 404 on Django site?

前端 未结 13 2302
既然无缘
既然无缘 2020-12-14 00:46

I\'m following the tutorial on Django\'s site to create a simple poll app. However, Django is unable to resolve \"//127.0.0.1:8000/polls\" , even though I\'ve defined the re

13条回答
  •  [愿得一人]
    2020-12-14 01:15

    Another way to access 127.0.0.1:8000/polls would be to redirect the browser when accessing 127.0.0.1:8000. It is done by editing .../mysite/mysite/urls.py as follows:

    from django.conf.urls import include, url
    from django.contrib import admin
    from polls import views
    
    urlpatterns = [
        url(r'^admin/', admin.site.urls),
        url(r'^polls/', include('polls.urls', namespace='polls')),
        url(r'^$', views.index, name='index'),
    ]
    

提交回复
热议问题