0
Djangoで残りのAPIのための関数ベースのビューを実装しようとしています。このエラーが発生すると、どうすればこの問題を解決できますか?以下はdjango関数ベースのAPIがurl.pyで認識されません - NameError
url(r'^api/get_employee', get_employee, name='get_employee'),
NameError: name 'get_employee' is not defined
私はあなたの意見からもわかるように、この問題
https://gitlab.com/firdausmah/railercom/blob/master/railercom/urls.py
from railercomapp import views
urlpatterns = [
url(r'^doc/', SwaggerSchemaView.as_view()),
url(r'^api/get_employee', get_employee, name='get_employee'),
https://gitlab.com/firdausmah/railercom/blob/master/railercomapp/views.py
@api_view(['GET'])
def get_employee(request):
return Response(Employee.objects.all().values(), status=status.HTTP_200_OK)
'url(r '^ api/get_employee'、views.get_employee、name = 'get_employee')、 ' – slackmart
が正しい感謝します。 – Axil