Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

django

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?

like image 249
kanade2017 Avatar asked Jan 18 '17 11:01

kanade2017


3 Answers

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
like image 159
Alasdair Avatar answered Oct 29 '22 22:10

Alasdair


It is caused by errors in views.py file as code code redirect link isn't properly working. so,Check views file to remove error

like image 23
Shah Vipul Avatar answered Oct 29 '22 21:10

Shah Vipul


just check whether urlpattern and change into patterns

like image 2
MR.D Avatar answered Oct 29 '22 22:10

MR.D