Django通知套接字“在处理请求期间发生异常”

时间:2020-11-01 18:10:34

标签: python django

我正在实施信号,并非每次都不会发生错误,也没有在发生或采取行动的特定时间

错误:

Exception happened during processing of request from ('127.0.0.1', 56261)
Traceback (most recent call last):
  File "C:\Users\Name\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Users\Name\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\Name\AppData\Local\Programs\Python\Python38\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Users\Name\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
    self.handle_one_request()
  File "C:\Users\Name\AppData\Local\Programs\Python\Python38\lib\site-packages\django\core\servers\basehttp.py", line 182, in handle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "C:\Users\Name\AppData\Local\Programs\Python\Python38\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

是因为py 3.8吗?

# signals.py
from django.db.models.signals import post_save
from django.dispatch import receiver

from .models import CustomAuthUser

@receiver(post_save, sender=CustomAuthUser)
def my_handler(sender, created, **kwargs):
    if created:
        print('USER CREATED')


# models.py
from django.db import models
from django.contrib.auth.models import AbstractUser

from .managers import CustomAuthUserManager

class CustomAuthUser(AbstractUser):
    username = None
    email = models.EmailField(max_length=255, unique=True)

    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

    objects = CustomAuthUserManager()

这都是逻辑

0 个答案:

没有答案