Django(8)
-
Technical Interview Question and Answer for Junior Backend Developer (1)
Python Q: What are Python decorators and how do you use them? A: A Python decorator is a design pattern that allows you to modify the behavior of a function or class. It's typically used for adding functionality to existing code in a modular and readable way. Decorators are applied using the '@' symbol before a function or method. Q: Can you explain the difference between lists and tuples in Pyt..
2024.01.22 -
[Django] What is Serialization?
Serialization is the process of converting a data object—a combination of code and data represented within a region of data storage—into a series of bytes that saves the state of the object in an easily transmittable form. In this serialized form, the data can be delivered to another data store (such as an in-memory computing platform), application, or some other destination. The reverse process..
2023.10.31 -
[Django] Connecting Frontend and Backend and Distribution 백엔드와 프런트엔드의 연결과 배포
Frontend와 Backend를 어떻게 연결하는지, 어떻게 배포로 연결되는지 궁금했다. 보통 프런트엔드와 백엔드를 구현하게 되면 runserver를 할 경우 다음의 url 로 연결해서 서버를 확인할 수 있게된다. 프런트엔드: http://127.0.0.1:5500 백엔드: http://127.0.0.1:8000 이번에 프로젝트는 AWS 배포까지 하려고 해보았는데, 그 과정에서 프런트와 백엔드 url의 간단한 연결의 과정들을 알게 된 것을 정리한다. 프런트엔드 api.js 에 위와 같이 url 설정을 해준다. 그럼 frontend runserver를 돌렸을때에는 위의 링크로 들어가면 frontend로 구현해놓은 페이지가 보이게 된다. 그럼 그 프런트엔드와 연결된 백엔드의 작업물들과는 아래 백엔드 링크로 ..
2023.10.31 -
[Django] postman 이용하여 수정하기 API 만들기
Postman을 이용하여 API 를 만들고 있다. 다음은 API로 수정하는 방법이다. 1. articles list 에서 게시글을 쓴 유저의 이메일을 확인 (또는 db로 확인) 2. login 에서 "access" 키 복사해서 environment - Initial value, Current value 에 저장 3. put 으로 설정한 후 주소창에 수정하려 하는 article number 입력 4. 내용 수정 *request 실행전 environment 설정 되어 있는지 꼭 확인*
2023.09.25 -
[Django] Solution for 'Error: AUTH_USER_MODEL refers to model 'users.User' that has not been installed'
Token 만들기를 하는 중이다. 아래 사이트에서 Customizing authentication 을 복사해서 붙여넣었다. https://docs.djangoproject.com/en/4.2/topics/auth/customizing/ Django The web framework for perfectionists with deadlines. docs.djangoproject.com 복사하여 Myuser 부분만 약간 수정함. #models.py from django.db import models from django.contrib.auth.models import BaseUserManager, AbstractBaseUser class UserManager(BaseUserManager): def create..
2023.09.21 -
[Django] 장고의 뼈대
장고는 파이썬에서 다운로드 받아 쓸 수 있는 웹사이트 제작 툴이다. 다운받아 처음 사용해봤는데, 기본적인 툴들이나 라이브러리들이 잘 갖춰져 있어서 처음부터 하나씩 직접 만들어야 하는 번거로움이 없고, 템플릿을 잘 사용하면 (그리고 익숙해지면) 유용하게 사용이 가능할 것 같다. 팀 프로젝트로 처음 만들어본 사이트의 뼈대이다. 우리는 가고싶은 나라 위시리스트를 작성하고, 인스타그램처럼 메인 페이지에서 게시된 모든 글들을 확인할 수 있게 했다. 사진/가고싶은 나라/가고싶은 도시/가고싶은 이유/ 등을 게시하고, 로그인 하지 않은 사용자들도 메인 뉴스피드를 볼 수 있고, 로그인 한 사람만 자신의 글을 수정할 수 있게 수현했다. 1. GROUPPROJECT: 장고를 저장한 로컬 폴더명이다. 보통 로컬 저장소를 설정..
2023.09.15