raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf ‘myproject.urls’ does not appear to have any patterns in it. If you see the ‘urlpatterns’ variable with valid patterns in the file then the issue is probably caused by a circular import.
I am getting this error when trying to runserver in my beginner follow up project.
path('', include('myapp.urls'))
it comes when I include the above code in my projects.urls file. I suggest the issue is from the views.py file.
Any Help pls?
Please post the complete urls.py file along with identifying its file name. Also post your myapp
urls.py
file.
Note: When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.
This is myproject urls.py
from django.urls import path, include
urls_patterns = [
path('admin/', admin.site.urls),
path('', include('myapp.urls')),
]```
I have gone through the documentation link and my Project code looks similar with the documentation sample Project.
You have to correct the variable name as mentioned in the exception and the documentation mentioned in previous answer:
urls_patterns
→ urlpatterns
In the Django framework urls.py the urlspatterns was spelt as it is why do we need to change it afterwards to urls_patterns
You don’t change it.
The list of urls defined in a urls.py file must be named urlpatterns
for it to be recognized by the url dispatcher.