inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트

django-pydenticon을 활용하여 프로필 디폴트 이미지 구현

AttributeError: module 'collections' has no attribute 'Callable' 에러 처리 방법

해결된 질문

4393

honge7694

작성한 질문수 9

3

강사님 안녕하세요.

강의 영상을 따라하던 중, 이러한 에러가 발생했습니다..

 

project/urls.py

from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import path, include
from django.views.generic import TemplateView
from django_pydenticon.views import image as pydenticon_image

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', login_required(TemplateView.as_view(template_name='root.html')), name='root'),
    path('identicon/image/<path:data>/', pydenticon_image,name='pydenticon_image'),
    path('accounts/', include('accounts.urls')),
]

if settings.DEBUG:
    import debug_toolbar
    urlpatterns += [
        path('__debug__/', include(debug_toolbar.urls))
    ]
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

 

project/sttings/common.py

INSTALLED_APPS = [
    # Django Apps
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Third Apps
    'bootstrap4',
    'debug_toolbar',
    'django_pydenticon',
    # Local Apps
    'accounts',
]

 

django react docker python

답변 1

4

honge7694

아 강사님이 다른 질문에 답변해주신거 보고 해결했습니다!! 감사합니다.

안녕하세요.

현재 파이썬 3.10을 쓰고 계시는 데요. django-pydenticon 내에서 사용되는 collections.Callable 참조가 파이썬 3.10부터 collections.abc.Callable로 이동하여, 제거된 Attribute라서 발생하는 오류입니다.

파이썬 3.9에서 collections.Callable을 참조하면 아래의 경고가 뜹니다.

<stdin>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

django-pydenticon이 파이썬 3.10을 지원해야 해결이 되는 이슈인데요.

파이썬 버전을 3.9로 내려서 실행을 해보실수도 있구요.

혹은 몽키패칭이지만, 프로젝트의 settings.py 상단에 다음을 추가하시어, 임시적으로 collections.Callable 속성을 collections.abc.Callable 로부터 복사하시는 방법도 있긴 합니다.

import collections
if not hasattr(collections, 'Callable'):
    collections.Callable = collections.abc.Callable

화이팅입니다. :-)

1

이진석

질 해결하셨습니다. 화이팅입니다. :-)

안녕하세요.

0

48

1

[OneToOne Field Demo] get_user_model() 메서드를 활용해야 하는 이유?

0

271

1

useEffect 훅에서 else 유무에 따른 결과

0

211

1

useAxios 훅의 dependency array 설정

0

245

1

useEffect에서 변수 업데이트 관련 질문

0

381

1

rest_framework.generics.CreateAPIView의 model 속성 유무

0

266

1

bootstrap4

0

469

4

리뉴얼 강의가 오픈이 되면 기존 강의는 더이상 못보는걸까요

1

361

1

admin form에서 앞선 필드 선택 후 다른 필드 select widget 구성하는 방법

0

572

3

useState는 필수일까요?

0

261

1

python manage.py makemigrations instagram 시 created_at default 오류가 발생합니다.

0

595

4

Django allauth를 사용한 소셜 로그인 시 에러

0

653

1

프로젝트명 변경 뒤, 디버그툴바+디버그모드 사용 시 에러

0

552

2

useLocalStorage() 함수 사용여부

0

228

1

django에 LOGIN_URL = '/accounts/login/'의 의미?

0

447

1

리듀서의 의미 재확인

0

429

1

simple-jwt Refresh Token 사용 노하우

0

897

2

docker compose 를 통한 배포 관련 오류 문의

0

669

1

파이썬 속도 장고 관련 궁금한게 있습니다.

0

364

1

is_like_user

0

233

1

related_name 오류

0

272

1

re_path 오류

0

258

1

re_path url

0

249

1

No post matches the given query

0

659

2