1👍
When python interpreter finds imports with same name it takes the latest one into account. In your urls.py
you have imported views
module from two distinct packages. Python interpreter will treat the name views
from the package restframework.authtoken
as the views
module not the one from django
because the import from the first one is the latest. Apart from that, you have imported consol_overall_view
directly from App.views
but referring it as a value from views
that you have imported before. Change views.consol_overall_view
to consol_overall_view
in your urlpatterns. Also, use aliases in your imports.
from django.contrib import admin
from django.urls import path,include
from django.urls import re_path
# import django.views with alias
from django import views as django_views
from App.views import CustomAuthToken
from.router import router
from rest_framework.authtoken import views
from django.views.generic import TemplateView
from App.views import consol_overall_view
urlpatterns = [
path('', TemplateView.as_view(template_name="social_app/index.html")),
path('admin/', admin.site.urls),
path('api/',include(router.urls)),
path('accounts/', include('allauth.urls')),
re_path('rest-auth/', include('rest_auth.urls')),
path('api-auth/', include('rest_framework.urls')),
re_path('rest-auth/registration/', include('rest_auth.registration.urls')),
path('api-token-auth/', views.obtain_auth_token),
path('api-token-auth/', CustomAuthToken.as_view()),
path('over', consol_overall_view),
]
Source:stackexchange.com