I create vote app from django
Writing your first Django app, part 4
from django.urls import path
from . import views
app_name = "polls"
urlpatterns = [
path("", views.IndexView.as_view(), name="index"),
path("<int:pk>/", views.DetailView.as_view(), name="detail"),
path("<int:pk>/results/", views.ResultsView.as_view(), name="results"),
path("<int:question_id>/vote/", views.vote, name="vote"),
]
after that code errors with
File “”, line 1387, in _gcd_import
File “”, line 1360, in _find_and_load
File “”, line 1331, in _find_and_load_unlocked
File “”, line 935, in _load_unlocked
File “”, line 995, in exec_module
File “”, line 488, in _call_with_frames_removed
File “C:\Users\Baxti\Desktop\django-app\polls\urls.py”, line 3, in
from . import views
File “C:\Users\Baxti\Desktop\django-app\polls\views.py”, line 5
from django.views import generic,
^
SyntaxError: trailing comma not allowed without surrounding parentheses
another Error why
File “”, line 1387, in _gcd_import
File “”, line 1360, in _find_and_load
File “”, line 1331, in _find_and_load_unlocked
File “”, line 935, in _load_unlocked
File “”, line 995, in exec_module
File “”, line 488, in _call_with_frames_removed
File “C:\Users\Baxti\Desktop\django-app\polls\urls.py”, line 9, in
path(“”, views.IndexView.as_view(), name=“index”),
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: ‘function’ object has no attribute ‘as_view’