我是django的新手,我想了解課堂觀點。class httpresponse results in 405 - django
在urls.py(主)我有:
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('webapp.urls')),
]
在web應用文件夾
我有:
urls.py(web應用):
from django.conf.urls import url
from webapp.views import Firstapp
urlpatterns = [
url(r'^whatever$', Firstapp.as_view()),
]
views.py(web應用):
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
class Firstapp(View):
def something(self):
return HttpResponse('Yes it works!')
正如我所說的,我試圖使用我會很感激,如果你能幫助我理解爲什麼課程返回405錯誤。謝謝。 CMD返回0個問題。
你好,是的,它的工作原理。謝謝。 –