Computer Science

고정 헤더 영역

글 제목

메뉴 레이어

Computer Science

메뉴 리스트

  • 홈
  • 태그
  • 방명록
  • 분류 전체보기 (29)
    • DataStructure and Algorithm (6)
    • Django (5)
    • Project Management (1)

검색 레이어

Computer Science

검색 영역

컨텐츠 검색

Django

  • Django with Docker

    2021.01.15 by BenzhaminKim

  • Relationship between URLS and VIEWS

    2020.10.29 by BenzhaminKim

  • Set Global Variable using settings.py

    2020.10.29 by BenzhaminKim

  • Django URL with View

    2020.10.29 by BenzhaminKim

  • Django Architecture

    2020.10.29 by BenzhaminKim

Django with Docker

# Base Image FROM python:3.6 # create and set working directory RUN mkdir /app WORKDIR /app # Add current directory code to working directory ADD . /app/ # set default environment variables ENV PYTHONUNBUFFERED 1 ENV LANG C.UTF-8 ENV DEBIAN_FRONTEND=noninteractive # set project environment variables # grab these via Python's os.environ # these are 100% optional here ENV PORT=8000 # Install syste..

Django 2021. 1. 15. 11:03

Relationship between URLS and VIEWS

I'm going to explain how the url works with views.py I put the angle bracket in the path as ''. If I put http://localhost:8000/view1/sss to URL, 'sss' value is going to be a parameter from kirr_redirect_view function as a second parameter (shortcode). If I put like below, path('view1/',kirr_redirect_view), def kirr_redirect_view(request,sss=None, *args, **kwargs): print(args) print(kwargs) print..

Django 2020. 10. 29. 16:51

Set Global Variable using settings.py

You want to use environment variables, so I'm going to talk about how to use it. First, you need to define the variable you want to use on settings.py Then, you set a variable on the file you want to use. Here, by using getattr(), you can set the variable. If you don't havr the attribute inside the class, then the third parameter,which is 15 in this case, replace for the variable.

Django 2020. 10. 29. 14:17

Django URL with View

There are two kinds of ways to make redirection. 1. Function based view 2. Class based view 1. Functiom based View First, you need to make a function having request as the first parameter, and I put *args and **kwargs just in case. The function is going to connect with urls.py as a view. 2. Class based view class KirrRedirectView(View): def get(self, request, *args, **kwargs): return HttpRespons..

Django 2020. 10. 29. 12:48

Django Architecture

URLs: While it is possible to process requests from every single URL via a single function, it is much more maintainable to write a separate view function to handle each resource. A URL mapper is used to redirect HTTP requests to the appropriate view based on the request URL. The URL mapper can also match particular patterns of strings or digits that appear in a URL and pass these to a view func..

Django 2020. 10. 29. 12:38

추가 정보

인기글

최신글

페이징

이전
1
다음
TISTORY
Computer Science © Magazine Lab
페이스북 트위터 인스타그램 유투브 메일

티스토리툴바