I understand circular import error has been asked about a lot but after going through these questions I haven't been able to solve my issue. When I try to run my server in Django its giving me this error message:
The included URLconf module 'accounts_app' from path\to\myproject\__init__.py 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.
The issue started when i added a new app which has a urls.py like the following
from django.conf.urls import url from . import views urlpatterns = [ url(r'^signin$', views.signin, name='signin'), url(r'^signout$', views.signout, name='signout'), url(r'^signup$', views.signup, name='signup'), ]
My project urls.py has a line which points to the app and looks like the following code
urlpatterns = [ url(r'^accounts/', include('accounts_app')), ]
My view looks like the following:
from django.shortcuts import render from django.http import HttpResponse def signin(request): return HttpResponse("<p>This the signin view</p>") def signout(request): return HttpResponse("<p>This the signout view</p>") def signup(request): return HttpResponse("<p>This the signup view</p>")
Can anyone please help me identify were I could possibly be going wrong.
In simplest terms, a circular import occurs when module A tries to import and use an object from module B, while module B tries to import and use an object from module A. You can see it on on an example with simple modules a.py and b.py: # a.py snippet. print('First line of a.py') from package.
for those who have the same error but still hasn't debugged their code, also check how you typed "urlpatterns"
having it mistyped or with dash/underscore will result to the same error
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With