Homoacademycus

  • Installation
  • TechOpinion
  • TroubleShooting
  • Develop Scripts

nginx proxy django 502

March 25, 2021

symtom

client <-http-> nginx(proxy) <-http-> was
Continue reading

install celery with django

March 25, 2021

설정 - djangoProj/configs/settings.py

Continue reading

django unhashable type OrderedDict

March 25, 2021

Symtoms

unhashable type: 'collections.OrderedDict'
Continue reading

django self recursive

March 25, 2021

N:M recursive 관계

the class to which the model is related, which works exactly the same as it does for ForeignKey, including recursive and lazy relationships.
  • 하나의 모델 안에서 ManyToManyField 사용
    class Person(models.Model):
      friends = models.ManyToManyField("self")
    
  • symmetrical=True 속성
    ManyToManyFields on self 에서만 사용 가능(default True)
    Person 모델에 person_set 속성을 추가 안하고 symmetrical 필드로 여겨짐
    intermediary 모델에서도 가능
    
  • Through 모델 : 연관을 위해 DB 테이블로 암시적으로 생성됨
  • Through 모델을 통한 필드는 시리얼라이저에서 Read-only 필드 ``` class Person(models.Model): name = models.CharField(max_length=50)
Continue reading

django rest response content type

March 25, 2021

Symtoms

django rest response object should return correspond content type with request. ``` REST framework supports HTTP content negotiation by providing a Response class which allows you to return content that can be rendered into multiple content types, depending on the client request.

Continue reading
Prev Next

Copyright with Homoacademycus