Reputation: 4028
In the the urls.py I have
from django.contrib import auth
urlpatterns = [
path('accounts/',include('auth.urls')),
]
ImportError: No module named 'auth'
But the following works
urlpatterns = [
path('accounts/',include('django.contrib.auth.urls')),
]
Why am I not able to former method?
Upvotes: 1
Views: 5323
Reputation: 6404
When you use auth.urls
, it aspect that you have an app named auth
and you installed it in settings.py
. But you don't have auth app.
But when you use django.contrib.auth.urls
that means you access Django auth app URLs which already installed. That why it works.
Upvotes: 2