# Circular Import URL

**URL:** <https://forum.djangoproject.com/t/circular-import-url/28350>\
**Category:** Mystery Errors\
**Created:** [February 23, 2024, 10:58am UTC](https://forum.djangoproject.com/t/circular-import-url/28350 "2024-02-23T10:58:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjamining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/benjamining/32/19387_2.png) [@benjamining](https://forum.djangoproject.com/u/benjamining)\
**Post date:** [February 23, 2024, 10:58am UTC](https://forum.djangoproject.com/t/circular-import-url/28350/1 "2024-02-23T10:58:43Z")

</div>

I can’t see where the circular import is

django.core.exceptions.ImproperlyConfigured: The included URLconf ‘\<module ‘Reciept.urls’ from ‘Reciept\urls.py’\>’ does not appear to have any patterns in it. If you see the ‘urlpatterns’ variable with valid patterns in the file then the issue is probably caused by a circular import

project level urls.py

```auto
from django.contrib import admin
from django.urls import path,include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('PPMS/', include('PPMS.urls')),
    path('Dispute/',include('Dispute.urls')),
    path('Reciept/', include('Reciept.urls'))
]

```

urls.py

```auto
from django.urls import path
from .views import Disputeindex

app_name='Dispute'

urlpatterns = [
    path('',Disputeindex, name='Disputeindex')
]

```

View.py

```auto
from django.shortcuts import render
def Recipetindex(request):

    return render(request, 'Reciept/index.html')

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 23, 2024, 11:25am UTC](https://forum.djangoproject.com/t/circular-import-url/28350/2 "2024-02-23T11:25:14Z")

</div>

We’d need to see _all_ the urls.py files in your project. The circular import situation may not be visible just by looking at the urls.py file from the Receipt app. (Also, please label the individual files to include the directory name. Under the project urls.py file you have another file labeled urls.py, but you don’t identify which app that file is from.)

And, it’s also possible that the circular imports involve files other than the urls.py files. You’ll want to check any file that the urls.py file imports, and what they import, etc, until you’re sure that there are no circular import situations.

---

<div class="post-metadata">

**Author:** ![benjamining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/benjamining/32/19387_2.png) [@benjamining](https://forum.djangoproject.com/u/benjamining)\
**Post date:** [February 23, 2024, 11:53am UTC](https://forum.djangoproject.com/t/circular-import-url/28350/3 "2024-02-23T11:53:15Z")

</div>

ZP\_DjangoProject/ZP\_DjangoProject/urls.py

```auto
from django.contrib import admin
from django.urls import path,include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('PPMS/', include('PPMS.urls')),
    path('Dispute/',include('Dispute.urls')),
    path('Reciept/', include('Reciept.urls')),
]

```

ZP\_DjangoProject/ZP\_DjangoProject/settigns.py

```auto
from pathlib import Path
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath( __file__ )))

# Build paths inside the project like this: BASE_DIR / 'subdir'.
# BASE_DIR = Path( __file__ ).resolve().parent.parent

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'PPMS.apps.PpmsConfig',
    'Reciept.apps.RecieptConfig',
    'Transactions.apps.TransactionsConfig',
    'Dispute.apps.DisputeConfig'
]

ROOT_URLCONF = 'ZP_DjangoProject.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'Z_templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

```

ZP\_DjangoProject/Dispute/urls.py

```auto
from django.urls import path
from .views import Disputeindex

app_name='Dispute'

urlpatterns = [
    path('',Disputeindex, name='Disputeindex')
]

```

ZP\_DjangoProject/Dispute/models.py

```auto
from django.db import models
from PPMS.models import Property

# Create your models here.
class Dispute(models.Model):
    dept = [
        ('Legal','Legal'),
        ('Credit Control','Credit Control'),
        ('Property Management','Property Management'),
        ('Pre Sales','Pre Sales'),
        ('Asset', 'Asset'),
        ('Subletting','Subletting')
    ]

    allocated_dept = models.CharField(max_length=50,choices=dept,blank=True)
    dispute_create_date = models.DateTimeField(auto_now_add=True)
    dispute_modified_date = models.DateTimeField(auto_now=True)
    disputor = models.CharField(max_length=100)
    disputor_telephone = models.CharField(max_length=12)
    disputor_email = models.EmailField()
    dispute_info = models.TextField()
    property = models.ForeignKey(Property, on_delete=models.CASCADE, related_name='DisProp')

    def __str__ (self):
        return f"{self.id} - {self.disputor}"

```

ZP\_DjangoProject/Dispute/views.py

```auto
from django.shortcuts import render
from .models import Dispute

# Create your views here.
def Disputeindex(request):
    disputes = Dispute.objects.all()

    return render(request, 'Disputes/index.html', {
                'disputes': disputes })

```

ZP\_DjangoProject/PPMS/urls.py

```auto
from django.urls import path
from .views import PPMSindex

urlpatterns = [
    path('',PPMSindex, name='PPMSindex')
]

```

ZP\_DjangoProject/PPMS/models.py

```auto
from django.db import models

# Create your models here.
class Owner(models.Model):
    owner_name = models.CharField(max_length=100)
    owner_reference = models.CharField(max_length=50)
    address_1 = models.CharField(max_length=100,blank=True)
    address_2 = models.CharField(max_length=100,blank=True)
    address_3 = models.CharField(max_length=100,blank=True)
    address_4 = models.CharField(max_length=100,blank=True)
    address_5 = models.CharField(max_length=100,blank=True)
    postcode = models.CharField(max_length=10,blank=True)
    bank = models.CharField(max_length=50, blank=True)
    type = models.CharField(max_length=50, blank=True)
    charge_to = models.CharField(max_length=50, blank=True)
    vat_number = models.CharField(max_length=50, blank=True)
    
    def __str__ (self):
        return {self.owner_reference} - {self.owner_name}

class Property(models.Model):
    property_name = models.CharField(max_length=100)
    property_reference = models.CharField(max_length=50)
    property_tenure = models.CharField(max_length=50, blank=True)
    property_status = models.CharField(max_length=50, blank=True)
    property_type = models.CharField(max_length=50, blank=True)
    address_1 = models.CharField(max_length=100,blank=True)
    address_2 = models.CharField(max_length=100,blank=True)
    address_3 = models.CharField(max_length=100,blank=True)
    address_4 = models.CharField(max_length=100,blank=True)
    address_5 = models.CharField(max_length=100,blank=True)
    postcode = models.CharField(max_length=10,blank=True)
    ipd_area = models.CharField(max_length=10, blank=True)
    start_date = models.DateField(blank=True)
    end_date = models.DateField(blank=True)
    title_number = models.CharField(max_length=50, blank=True)
    UPRN = models.CharField(max_length=50, blank=True)
    charged_to = models.CharField(max_length=50, blank=True) 
    owner = models.ForeignKey(Owner,on_delete=models.CASCADE, related_name='propowner', null=True)

    def __str__ (self):
        return {self.property_reference} - {self.property_name}

class Unit(models.Model):
    unit_name = models.CharField(max_length=100)
    unit_reference = models.CharField(max_length=50)
    unit_tenure = models.CharField(max_length=50, blank=True)
    unit_status = models.CharField(max_length=50, blank=True)
    unit_type = models.CharField(max_length=50, blank=True)
    address_1 = models.CharField(max_length=100,blank=True)
    address_2 = models.CharField(max_length=100,blank=True)
    address_3 = models.CharField(max_length=100,blank=True)
    address_4 = models.CharField(max_length=100,blank=True)
    address_5 = models.CharField(max_length=100,blank=True)
    postcode = models.CharField(max_length=10,blank=True)
    UPRN = models.CharField(max_length=50, blank=True)
    lease_startdate = models.DateField(blank=True)
    lease_enddate = models.DateField(blank=True)
    lease_date = models.DateField(blank=True)
    lease_term = models.IntegerField(blank=True)
    charge_type = models.CharField(max_length=50, blank=True)
    property = models.ForeignKey(Property, on_delete=models.CASCADE, related_name='unitprop', null=True)

    def __str__ (self):
        return {self.unit_reference} - {self.unit_name}

class Tenant(models.Model):
    tenant_name = models.CharField(max_length=100)
    tenant_reference = models.CharField(max_length=50, blank=True)
    tenant_status = models.CharField(max_length=100, blank=True)
    address_1 = models.CharField(max_length=100,blank=True)
    address_2 = models.CharField(max_length=100,blank=True)
    address_3 = models.CharField(max_length=100,blank=True)
    address_4 = models.CharField(max_length=100,blank=True)
    address_5 = models.CharField(max_length=100,blank=True)
    postcode = models.CharField(max_length=10,blank=True)
    telephone_1 = models.CharField(max_length=12, blank=True) 
    telephone_2 = models.CharField(max_length=12, blank=True)
    mobile = models.CharField(max_length=12, blank=True)   
    email_1 = models.EmailField(blank=True)
    email_2 = models.EmailField(blank=True)
    start_date = models.DateField(blank=True)
    end_date = models.DateField(blank=True)
    unit = models.ForeignKey(Unit, on_delete=models.CASCADE, related_name='tenantunit', null=True)
    
    def __str__ (self):
        return {self.tenant_reference} - {self.tenant_name}

```

ZP\_DjangoProject/PPMS/views.py

```auto
from django.shortcuts import render

def PPMSindex(request):

    return render(request, 'PPMS/index.html')

```

ZP\_DjangoProject/Reciept/urls.py

```auto
from django.urls import path
from .views import Recipetindex

app_name='Reciept'

urlpatterns = [
    path('',Recipetindex,name='Recieptindex'),
]

```

ZP\_DjangoProject/Reciepts/models.py

```auto
from django.db import models

```

ZP\_DjangoProject/Reciepts/views.py

```auto
from django.shortcuts import render
def Recipetindex(request):

    return render(request, 'Reciept/index.html')

```

ZP\_DjangoProject/Transactions/urls.py

```auto
from django.urls import path
from .views import tranIndex

app_name='Transaction'

urlpatterns = [
    path('',tranIndex,name='tranindex')
]

```

ZP\_DjangoProject/Transactions/models.py

```auto
from django.db import models

```

ZP\_DjangoProject/Transactions/views.py

```auto
from django.shortcuts import render

# Create your views here.
def tranIndex(request):

    return render(request, 'Tran/index.html')

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 23, 2024, 12:14pm UTC](https://forum.djangoproject.com/t/circular-import-url/28350/4 "2024-02-23T12:14:17Z")

</div>

I’m not seeing any circular imports here.

Do you have any imports in your various `apps.py` files other than imports from Django?

---

<div class="post-metadata">

**Author:** ![benjamining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/benjamining/32/19387_2.png) [@benjamining](https://forum.djangoproject.com/u/benjamining)\
**Post date:** [February 23, 2024, 12:25pm UTC](https://forum.djangoproject.com/t/circular-import-url/28350/5 "2024-02-23T12:25:08Z")

</div>

No other import statements other than the standard import from Django

The admin files have model import statements where I have defined models

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 23, 2024, 12:32pm UTC](https://forum.djangoproject.com/t/circular-import-url/28350/6 "2024-02-23T12:32:08Z")

</div>

Just to confirm. In your post you have:

> [@benjamining](#):
>
> ZP\_DjangoProject/Reciept/urls.py

But, you then have:

> [@benjamining](#):
>
> ZP\_DjangoProject/Reciepts/models.py

and

> [@benjamining](#):
>
> ZP\_DjangoProject/Reciepts/views.py

I’m assuming this is just a typo in your post? That the directory here is actually “Reciept” and not “Reciepts”?

---

<div class="post-metadata">

**Author:** ![benjamining](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/benjamining/32/19387_2.png) [@benjamining](https://forum.djangoproject.com/u/benjamining)\
**Post date:** [February 23, 2024, 12:48pm UTC](https://forum.djangoproject.com/t/circular-import-url/28350/7 "2024-02-23T12:48:59Z")

</div>

yeah that’s a typo by me

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [February 23, 2024, 1:29pm UTC](https://forum.djangoproject.com/t/circular-import-url/28350/8 "2024-02-23T13:29:49Z")

</div>

What command are you running that is creating this output?

What happens if you try to run manage.py shell? Do you still get this error? How about manage.py check?

What if you comment out the include for `Receipt.urls`? Does an error still occur? If it does, then the error you are receiving is a false flag - the real problem is somewhere else and is only showing up during the url import process.

The only other idea that I have right off-hand would be to use the python `-v` parameter to see all the imports that are done, and to try and identify where the issue is occurring.  
(Don’t bother posting it here, it’s going to be too big. You’ll need to read through it to see if you can identify an issue.)

For even more output, you could use the [trace module](https://docs.python.org/3/library/trace.html) to see _exactly_ what’s happening. I don’t generally recommend this, but there are times when you just need to “see” how things are happening.

---

<div class="post-metadata">

**Author:** ![qvisty](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/qvisty/32/4818_2.png) [@qvisty](https://forum.djangoproject.com/u/qvisty)\
**Post date:** [February 25, 2024, 9:59am UTC](https://forum.djangoproject.com/t/circular-import-url/28350/9 "2024-02-25T09:59:00Z")

</div>

> [@benjamining](#):
>
> `Recipetindex(request)`

Recipet not Reciept?

---

<div class="post-metadata">

**Author:** ![nelson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/nelson/32/30643_2.png) [@nelson](https://forum.djangoproject.com/u/nelson)\
**Post date:** [November 18, 2025, 12:34pm UTC](https://forum.djangoproject.com/t/circular-import-url/28350/10 "2025-11-18T12:34:47Z")

</div>

Hey, did you ever get this issue figured out/?
