Hi,

Probably not enough to look at urls.py files only. My guess: Do you use
‘reverse’ function anywhere in covid app? If so, here’s a circular import:

urls.py imports covid urls -> covid urls import covid views -> one covid
view uses reverse -> reverse import urls.py of the project (to look up the
url with the end point name).

A quick fix will be using lazy_reverse instead of reverse.

On Wed, 22 Jul 2020 at 10:22 PM, sandeep kumar <sandeep25...@gmail.com>
wrote:

> I have faced this issue atleast 100 times..:)
>
> Her are the steps (sorry, I could not find a better way):
>
> 1. comment urls in urls.py (inside individual app)
> 2. check if you still have issue
> 2a. if you do not have issue, then you probably have not defined views for
> some of the urls
> 2b. if you still see the error, comment 'impot views' statement.
> 3a. if the issue is gone after commenting 'import views' then check
> views.py file, it must have some typos (e.g., misalignment, accidental
> copying of some special character etc.)
> 3b. if the issue is not gone even after commenting 'import views', let me
> know. I am not sure I have reached that stage ever..:)
>
> Hope this helps.
>
> Thanks,
> Sandeep
>
> --
> *Dr. Sandeep Kumar,*
> Postdoctoral Researcher,
> Lunenfeld Tanenbaum Research Institute,
> Mount Sinai Hospital,
> 600 University Ave,
> <https://www.google.com/maps/search/600+University+Ave,+Toronto,+Ontario+Canada?entry=gmail&source=g>
> Toronto, Ontario
> <https://www.google.com/maps/search/600+University+Ave,+Toronto,+Ontario+Canada?entry=gmail&source=g>
> Canada
> <https://www.google.com/maps/search/600+University+Ave,+Toronto,+Ontario+Canada?entry=gmail&source=g>
> http://individual.utoronto.ca/sandeepkumar/
>
>
> On Wed, Jul 22, 2020 at 10:12 AM Chaitanya Sai <chaitu.orak...@gmail.com>
> wrote:
>
>> Hello Django users,
>> Is there not even single person who can solve this issue??????????????
>>
>>
>> On Tue, Jul 21, 2020 at 8:09 PM Sai <chaitu.orak...@gmail.com> wrote:
>>
>>> I am working Django rest framework api project, where I had multiple
>>> apps in the project. I got a circular import error when I am adding the app
>>> URLs to the main URLs. I Tried everything checked spellings, checked app
>>> structure but no use. Its been really frustrating with issue..please help
>>> to solve the problem. The app is working fine when I take off newly added
>>> line `path("covid/", include("Covid.urls")),`
>>>
>>> I am using python3.6, django 3.0.4 and django-rest-framework 3.11.0
>>>
>>> Here is project
>>> **urls.py**
>>>
>>>
>>>     from django.contrib import admin
>>>     from django.conf.urls import url
>>>     from django.urls import path, include
>>>     from rest_framework_swagger.views import get_swagger_view
>>>
>>>     schema_view = get_swagger_view(title='TmmrwInc API Documentation')
>>>
>>>     urlpatterns = [
>>>         path('admin/', admin.site.urls),
>>>         # path('', include('django.contrib.auth.urls')),
>>>         # path('rest_auth/', include('rest_auth.urls')),
>>>         path('api/password_reset/',
>>>             include('django_rest_passwordreset.urls',
>>> namespace='password_reset')),
>>>         # url(r'^invitations/', include('invitations.urls',
>>> namespace='invitations')),
>>>         path('', include('rest_invitations.urls')),
>>>         path("", include("UserAuth.urls")),
>>>         path("doctors/", include("Administration.urls")),
>>>         path("appointments/", include("Appointments.urls")),
>>>         path("messaging/", include("messaging.urls")),
>>>         path("meet/", include("meet.urls")),
>>>         path("api_documentation/", schema_view),
>>>         path("covid/", include("Covid.urls")),
>>>     ]
>>>
>>> This is app **urls.py** file
>>>
>>>     from django.urls import path
>>>     from . import views
>>>
>>>     app_name = 'Covid'
>>>
>>>     urlpatterns = [
>>>         path('event/', views.EventBookingView.as_view()),
>>>     ]
>>>
>>> **settings.py** installed apps
>>>
>>>     ALLOWED_HOSTS = ['*']
>>>
>>>
>>>     # Application definition
>>>
>>>     INSTALLED_APPS = [
>>>         "django.contrib.admin",
>>>         "django.contrib.auth",
>>>         "django.contrib.sites",
>>>         "django.contrib.contenttypes",
>>>         "django.contrib.sessions",
>>>         "django.contrib.messages",
>>>         "django.contrib.staticfiles",
>>>         "UserAuth",
>>>         "rest_framework",
>>>         "corsheaders",
>>>         'rest_framework.authtoken',
>>>         'rest_auth',
>>>         'Appointments',
>>>         'messaging',
>>>         'Administration',
>>>         'channels',
>>>         'invitations',
>>>         'rest_invitations',
>>>         'django_rest_passwordreset',
>>>         'django_celery_beat',
>>>         'meet',
>>>         'rest_framework_swagger',
>>>          'Covid',
>>>
>>>     ]
>>>
>>> This is a project structure
>>>
>>> [Project Structure][1]
>>>
>>>
>>>   [1]: https://i.stack.imgur.com/E8qro.jpg
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/90296ccf-c893-4cf1-b57a-2da47396a2bbo%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/90296ccf-c893-4cf1-b57a-2da47396a2bbo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPcTzRYQztSpyh5AD%3DYo9%3DYMvRHfYcFBXdfq6rrK956ZqdcAcQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAPcTzRYQztSpyh5AD%3DYo9%3DYMvRHfYcFBXdfq6rrK956ZqdcAcQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKZkrP4nZXF_NDUuXSM9PchfZZ%2BMxKyWGB-vXBu9ay1eTcD8Jw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAKZkrP4nZXF_NDUuXSM9PchfZZ%2BMxKyWGB-vXBu9ay1eTcD8Jw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGQ3pf-Hu7-0bU0jqWQ7cZx2cMDtaB4AE9qGenzwStQoHA4EKA%40mail.gmail.com.

Reply via email to