I got
does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import error .
I wrote in urls.py of child app
from django.conf.urls import url from django.contrib.views import login,logout urlpatterns = [ url(r'^login/$', login, name='login'), url(r'^logout/$', logout, name='logout') ]
in urls.py of parent app,
from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^accounts/', include('accounts.urls')), url(r'^api/', include('UserToken.urls')), url(r'^UserDataAPI/', include('UserDataAPI.urls', namespace='UserDataAPI')), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
I am thinking urls.py of child or parent app,but I do not know how to fix it. What should I do?
Advertisement
Answer
Your import is incorrect. The views.py
containing login
and logout
is in the django.contrib.auth
app:
from django.contrib.auth.views import login, logout