こんにちは私は最初のDjangoプログラムを書いています。文字列を受け入れないフォーラムのURLの人々によるとビューが呼び出し可能なままエラーが発生しましたビューは呼び出し可能でなければなりません-Django
from django.http import HttpResponse
class Users:
def getUsers(self):
return HttpResponse("Hello Users")
:
from django.conf.urls import url
from django.contrib import admin
from . import view
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^hello/',view.Users().getUsers(), name='hello')
]
これはview.pyです:これは私のurls.pyです
url(r'^hello/',view.Users().getUsers(), name='hello')
File"C:\Users\jayant.brahmchari\AppData\Local\Programs\Python\Python36\lib\si
te-packages\django\conf\urls\__init__.py", line 85, in url
raise TypeError('view must be a callable or a list/tuple in the case of
include().')
TypeError: view must be a callable or a list/tuple in the case of include().
:私はこのエラーを取得しています2番目の引数として私のコードビューではすでに呼び出し可能ですが、まだこのエラーが発生します。
ありがとうございます。
結果を最終的に呼び出すように関数を呼び出しています。 'view.Users()。getUsers'のかっこ'() 'を削除します。 – metmirr
はお世話になりました。 – Jayant