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

Question:

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?

Asked By: kanade2017

||

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
Answered By: 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

Answered By: Shah Vipul

In your outermost urls file, if you are including other package urls like

path("accounts/", include("UserDataAPI.urls"))

or

url(r'^accounts/', include('accounts.urls'))

Ensure that in accounts.urls module or UserDataAPI.urls modules you have declared the urlpatterns variable

Answered By: Nwawel A Iroume

just check whether urlpattern and change into patterns

Answered By: MR.D
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.