File "D:\ChatResponder\responder\responder\urls.py", line 19, in <module> from api.views…
- User
File "D:\ChatResponder\responder\responder\urls.py", line 19, in from api.views import views ImportError: cannot import name 'views' from 'api.views' (D:\ChatResponder\responder\api\views.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\benrajj\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Users\benrajj\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run self._target(*self._args, **self.kwargs) File "D:\ChatResponder\env\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "D:\ChatResponder\env\Lib\site-packages\django\core\management\commands\runserver.py", line 134, in inner_run self.check(display_num_errors=True) File "D:\ChatResponder\env\Lib\site-packages\django\core\management\base.py", line 486, in check all_issues = checks.run_checks( ^^^^^^^^^^^^^^^^^^ File "D:\ChatResponder\env\Lib\site-packages\django\core\checks\registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ChatResponder\env\Lib\site-packages\django\core\checks\urls.py", line 138, in check_custom_error_handlers path = getattr(resolver.urlconf_module, "handler%s" % status_code) ^^^^^^^^^^^^^^^^^^^^^^^ File "D:\ChatResponder\env\Lib\site-packages\django\utils\functional.py", line 47, in get res = instance.dict[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "D:\ChatResponder\env\Lib\site-packages\django\urls\resolvers.py", line 711, in urlconf_module return import_module(self.urlconf_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\benrajj\AppData\Local\Programs\Python\Python312\Lib\importlib_init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 "D:\ChatResponder\responder\responder\urls.py", line 19, in from api.views import views ImportError: cannot import name 'views' from 'api.views' (D:\ChatResponder\responder\api\views.py)
- Assistant
The error message indicates that there is an issue with the import statement in your Django application's
urls.pyfile. Specifically, it seems that Python is unable to find a name calledviewsin theapi.viewsmodule. Here are a few steps to troubleshoot and resolve this issue:-
Check the
views.pyFile:- Open the file and ensure there is a object, class, or function defined in it. If it's not present, you cannot import it.
-