I am trying to run my first Django application and when I run server I get the following error:
ImportError: cannot import name 'urlpatterns' from 'django' (C:\Users\Chris\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\__init__.py)
Why is the following command that I use in views.py giving me errors:
from django import urlpatterns
As far as I know it should work? I have tried searching the web for an answer but I couldn't find anything.
There is no need to import
urlpatternsfrom anywhere.urlpatternsis a variable that should be defined in theurls.pyfile, so:There also should not be a trailing comma after the closing square bracket (
]).