我是django和web框架的新手。由於Django的1.11.4的文件中說,我改變了投票/ view.py作爲django 1.11民意調查應用程序不工作
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world. You're at the polls index.")
後,我創建民調/ urls.py並在寫代碼:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
最後改變的mysite/urls.py作爲
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.site.urls),
]
當我運行這個項目有:蟒蛇manage.py runserver命令
它顯示錯誤,當進入 「http://localhost:8000/polls/」:
Not Found: /polls/
[09/Aug/2017 12:01:36] "GET /polls/ HTTP/1.1" 404 1947
我添加投票站安裝的應用程序。還有什麼要做?