Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

341
Views
Django possible circular import

I'm setting up a new "Game" website. I have started a new app Games, set up the games/models.py with the code (below). After makemigrations game and migrate, I was able to log into Admin and add entries.

Then I set to create the URLs, views, one template. After creating them, when I runserver, I get the following error:

url_patterns raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'games.urls' from '/home/mackley/PycharmProjects/alphabet/games/urls.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 first thing I noticed is that the top line (from django.conf import settings) of games/models.py (using PyCharm) is greyed out. I don't know if that has anything to do with the error:

Can anyone spot where I have made a mistake? Here is the relevant code.

# games/models.py
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
from django.urls import reverse


class Game(models.Model):
    title = models.CharField(max_length=255)
    date_create = models.DateTimeField(auto_now_add=True)
    date_start = models.DateTimeField(auto_now_add=False)
    body = models.TextField()
    author = models.ForeignKey(
        get_user_model(),
        on_delete=models.CASCADE,
    )
    answer_one = models.CharField(max_length=1)
    answer_two = models.CharField(max_length=1)
    answer_three = models.CharField(max_length=1)
    answer_four = models.CharField(max_length=1)
    answer_five = models.CharField(max_length=1)
    answer_six = models.CharField(max_length=1)
    answer_seven = models.CharField(max_length=1)
    payout_total = models.FloatField(null=True, blank=True, default=1.0)

    def __str__(self):
        return self.title

    def get_absolute_url(self):
        return reverse('game_detail', args=[str(self.id)])

games/admin

   # games/admin.py
    from django.contrib import admin
    from .models import Game
    
    admin.site.register(Game)

config/urls

# config/urls.py
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('accounts.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('games/', include('games.urls')),
    path('', include('pages.urls')),
]

games/url

# games/urls.py
from django.urls import path
from .views import GameListView

urlpattrns = [
    path('', GameListView.as_view(), name='game_list'),
]

games/views.py

# games/views.py
from django.views.generic import ListView
from .models import Game

class GameListView(ListView):
    template_name = 'game_list.html'
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As the error states, this happens when django can't find valid urlpatterns in your urlconf. There could be many reasons for this but the one that seems most likely to me in your case is that urlpatterns is misspelled as 'urlpattrns' in games/urls.py. Try fixing the typo then running again.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!