티스토리

Computer Science
검색하기

블로그 홈

Computer Science

younghwi.tistory.com/m

IT, 프로그래밍 블로그

구독자
1
방명록 방문하기

주요 글 목록

  • 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.. 공감수 0 댓글수 0 2021. 1. 15.
  • 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.. 공감수 0 댓글수 0 2020. 10. 29.
  • 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. 공감수 0 댓글수 0 2020. 10. 29.
  • 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.. 공감수 1 댓글수 0 2020. 10. 29.
  • 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.. 공감수 1 댓글수 0 2020. 10. 29.
    문의안내
    • 티스토리
    • 로그인
    • 고객센터

    티스토리는 카카오에서 사랑을 담아 만듭니다.

    © Kakao Corp.