강의

멘토링

커뮤니티

Inflearn Community Q&A

jmchan24320098's profile image
jmchan24320098

asked

Introduction to Python Django, starting with Django design philosophy

Hands-on - Creating an email subject/content message using the Django template system

메일 전송하는 부분은 어떨때 쓰는건가요?

Written on

·

65

0

메일 전송을 커맨드로 지정해주셨는데,

 

어떤 상황에서 보통 사용되는지 궁금합니다.

 

그리고, 서비스 내에서 특정 상황에서 알아서 (python manage.py ~ 명령어를 터미널에 따로 입력하지않아도) 이메일을 보내게 하려는 것이라면 어떻게 커맨드로 설정해놓은 저 부분을 실행시키는지 궁금합니다.

pythondjango

Answer 1

0

pyhub님의 프로필 이미지
pyhub
Instructor

안녕하세요.

장고 management command의 경우, call_command 메서드를 통해 지정 명령을 호출하실 수 있습니다.
https://docs.djangoproject.com/en/5.2/ref/django-admin/#running-management-commands-from-your-code

그런데 이메일 전송의 경우, 다양한 곳에서 사용될 수 있으니 call_command를 쓰시기보다, 별도 함수로 구현하시고 management command에서는 함수를 호출해서 쓰시는 것이 관리성이 더 나으실 수 있으실 듯 합니다.

살펴보시고 댓글 남겨주세요. :-)

jmchan24320098's profile image
jmchan24320098

asked

Ask a question