Django TypeError - TypeError: issubclass() arg 1 must be a class

Я хочу перенести свой конфиг в приложение django, но приведенная ниже консоль не работает. не работает.

python3 manage.py migrate

python3 manage.py makemigrations

Traceback (most recent call last):
  File "/usr/src/frontend/manage.py", line 22, in <module>
    main()
  File "/usr/src/frontend/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/mungmung01/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/home/mungmung01/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/home/mungmung01/.local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/mungmung01/.local/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/mungmung01/.local/lib/python3.9/site-packages/django/apps/config.py", line 228, in create
    if not issubclass(app_config_class, AppConfig):
TypeError: issubclass() arg 1 must be a class

Я не знаю, что было не так. Мой конфиг в приложении django очень короткий.

Вот мой urls.py

from django.contrib import admin
from django.urls import path
from mungmung01.views import *

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', MainPage.as_view())
]

А вот мой models.py

from django.db import models
from django.db.models.deletion import CASCADE

# 전체 데이터모델은 이곳에 구현되어 있습니다.
# PositiveInteger = unsigned int입니다.

class MainPageVisitor(models.Model):
    VisitorNum = models.PositiveIntegerField(primary_key=True, null=False) # 방문객번호
    NumVisit = models.PositiveSmallIntegerField(null=False) # 방문한 횟수
    ipAddress = models.GenericIPAddressField() # ip주소
    TimeVisited = models.DateTimeField(null=False) # 방문시간
    TimeLeft = models.DateTimeField(null=False) # 떠난시간
    Service = models.SmallIntegerField() # 이용한 서비스. 1=홀랜드 | 2=철학 | 3=엔지니어링 | 4=질의응답

Вот мой views.py

from django.http import request
from django.shortcuts import render
from django.contrib.auth.signals import user_logged_out # 클라이언트가 접속을 종료하는 시간을 재기 위해 추가
from django.views import ListView # 클래스형 뷰를 사용하기 위해 추가
from django.template import *
from .models import MainPageVisitor
from .views import MainPage
from ipware.ip import get_ip # ip주소 받기 위해 추가
from .views import *
import datetime
import pytz

class MainPage(ListView):
    visitornum = 0
    timeleft = user_logged_out.connect(request) # 떠난 시간
    def __init__(self, Visitor: MainPageVisitor, Page: MainPage):
        ip = get_ip(request)
        whethernewly = Visitor.objects.filter(ipAddress = ip) # 이 사이트에 방문한 적이 없는 경우 빈 리스트가 반환됩니다.
        if (whethernewly == []):
            Visitor.objects.create(VisitorNum = Page.visitornum, NumVisit = 1, ipAddress = ip,
               TimeVisited = datetime.datetime.now(pytz.timezone('Asia/Seoul')), TimeLeft = Page.timeleft)
        else:
            Visitor.objects.create(VisitorNum = Page.visitorNum, NumVisit = len(whethernewly), ipAddress = ip,
               TimeVisited = datetime.datetime.now(pytz.timezone('Asia/Seoul')), TimeLeft = Page.timeleft, Service = 1)
    def get(self, request):
        return render(request, 'index.html', context)
    def __del__(self, Page: MainPage):
        Page.visitornum += 1

В файле views.py я не ввожу значение колонки Service, но я думаю, что это не проблема. Это проблема?

И ничего config не существует.

ps. пожалуйста, проигнорируйте корейский комментарий.

Я настроил views.py следующим образом. И это было успешно.

from django.http import request
from django.shortcuts import render
from django.contrib.auth.signals import user_logged_out # 클라이언트가 접속을 종료하는 시간을 재기 위해 추가
from django.views import View # 클래스형 뷰를 사용하기 위해 추가
from django.template import *
from typing import TypeVar # 제네릭을 쓰기 위해 추가
from ipware.ip import get_ip # ip주소 받기 위해 추가
from .views import *
import datetime
import pytz

MainPageVisitor = TypeVar('MainPageVisitor')

class MainPage(View):
    visitornum = 0
    timeleft = user_logged_out.connect(request) # 떠난 시간
    def __init__(self, Visitor: MainPageVisitor):
        ip = get_ip(request)
        whethernewly = Visitor.objects.filter(ipAddress = ip) # 이 사이트에 방문한 적이 없는 경우 빈 리스트가 반환됩니다.
        if (whethernewly == []):
            Visitor.objects.create(VisitorNum = self.visitornum, NumVisit = 1, ipAddress = ip,
               TimeVisited = datetime.datetime.now(pytz.timezone('Asia/Seoul')), TimeLeft = self.timeleft)
        else:
            Visitor.objects.create(VisitorNum = self.visitorNum, NumVisit = len(whethernewly), ipAddress = ip,
               TimeVisited = datetime.datetime.now(pytz.timezone('Asia/Seoul')), TimeLeft = self.timeleft, Service = 1)
    def get(self, request):
        return render(request, 'index.html', context)
    def __del__(self):
        self.visitornum += 1
Вернуться на верх