simple Rest_framework cannot import name in api view

2,659 views
Skip to first unread message

MEGA NATHAN

unread,
Nov 13, 2019, 2:18:00 AM11/13/19
to Django users
Hi.

i was creating simple REST_framework this api view ,connot import name in error. how to reslove this error 



__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\drf_api\urls.py", line 4, in <module>
    from core.views import test_view
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py", line 6, in <module>
    from rest_framework.views import APIview
ImportError: cannot import name 'APIview' from 'rest_framework.views' (C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rest_framework\views.py)


Regards
Meganathan G
rest1.PNG
rest2.PNG
rest3.PNG

MEGA NATHAN

unread,
Nov 13, 2019, 4:02:11 AM11/13/19
to Django users
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 577, in urlconf_module
    return import_module(self.urlconf_name)
  File "C:\Users\Meghanathan\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\drf_api\urls.py", line 4, in <module>
    from core.views import TestView
  File "C:\Users\Meghanathan\Desktop\java script\drf_api\core\views.py", line 8, in <module>
    from core.serializers import PostSerializer
ImportError: cannot import name 'PostSerializer' from 'core.serializers' (C:\Users\Meghanathan\Desktop\java script\drf_api\core\serializers.py)

Suraj Thapa FC

unread,
Nov 13, 2019, 4:45:25 AM11/13/19
to django...@googlegroups.com
It should be like.. APIView  not like APIview

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6f7e0d7c-262b-4bb8-b3b4-fe44f0e7d991%40googlegroups.com.

MEGA NATHAN

unread,
Nov 13, 2019, 6:17:18 AM11/13/19
to django...@googlegroups.com

Suneetha Machineni

unread,
Apr 4, 2020, 4:33:36 PM4/4/20
to Django users
Even am also facing same issue what MEganathan posted.
can anyone help me  thanks in advance 
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django...@googlegroups.com.

Suraj Thapa FC

unread,
Apr 4, 2020, 6:51:03 PM4/4/20
to django...@googlegroups.com
List go through the emails

To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8543c19-2162-4d17-a806-312b809780f9%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages