Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Django

Similar presentations


Presentation on theme: "Introduction to Django"— Presentation transcript:

1 Introduction to Django
`09 Summer SPARCS Seminar Introduction to Django SPARCS `08 서우석(pipoket)

2 Request Page Give Page …on what Protocol?
What is Web? Request Page Give Page …on what Protocol? Server 페이지 줘 <html> <head> …. Client

3 HTTP Hyper Text Transfer Protocol
Protocol for HyperText HTTP/1.0 HTTP/1.1

4 HTTP Hyper Text Transfer Protocol
Header HTTP/ OK Content-Type: text/html HTML File <html><head><title>…

5 Serving Webpage 해당 페이지를 돌려준다 요청을 받는다 요청을 기다린다 Following HTTP

6 Serving Webpage Apache는… HTTP 요청을 받고 해당하는 HTML문서 포착 HTTP 프로토콜에 맞게 포장 요청한 클라이언트에 전달

7 내용이 계속 변한다 코드를 계속 수정? 1분 단위로 업데이트? 1초 단위로 업데이트? HOW?
Serving Webpage 내용이 계속 변한다 코드를 계속 수정? 1분 단위로 업데이트? 1초 단위로 업데이트? HOW?

8 CGI Common Gateway Interface
HTML 한번 만들면 바꾸기 힘들다 그렇다면 그때그때 HTML을 생성하자!

9 CGI Common Gateway Interface
단점 지저분하다 <html><head>… 신경쓸 것이 많다 Content-Type… 디버깅이 힘들다 500 Internal Server Error 보안이 취약할지도? 고의로 Exception을… 추가적인 기능 구현이 힘들다 Database와의 연동? 다른 모듈들과의 연동?

10 HTML 한번 만들면 바꾸기 힘들다 그럼, 분리하자! HTML과 자료 처리와 자료 저장
Django HTML 한번 만들면 바꾸기 힘들다 그럼, 분리하자! HTML과 자료 처리와 자료 저장

11 Django Django Framework Model (DB) Controller (Code) View (html)

12 # apt-get install python-django
How to Install On Debian-Package System Or you can compile and install it! # apt-get install python-django # easy_install django

13 Django Workflow “Project” “Applications” Make own “View”, “Model”
Connect “View” with “urls.py” Check with “Dev. Server”

14 $ django-admin.py startproject “ProjectName”
Start Django Project $ django-admin.py startproject “ProjectName”

15 Start Django Application
$ django-admin.py startapp “ApplicationName”

16 Make View

17 Connect URL with View Import view Connect view with URL

18 URL is connected to view
Start Dev. Server $ cd $ROOT_PATH_TO_PROJET $ python manage.py runserver :8080 URL is connected to view

19 Conclusion Simple Concept of HTTP Why Django is necessary How to Install Django Basic Dev. Flow in Django

20 Homework Download the file Extract the downloaded file to any path you want (Refer the Python101, Python102 pdf about extraction) You have to make a simple web application does… Get the input from the form Save the input to the file Show the entry of the file

21 USE THE PORT RANGE BETWEEN 20000-30000
Homework Form and getting input is already implemented What you have to do is… Implement the “TODO” part on “input” and “show” functions They are in “spseminar/studentinfo/views.py” Read the comment carefully (hey, it`s in Korean ) Implement the function as you wish You should need Dev. Server. USE THE PORT RANGE BETWEEN If some port is already taken, use the other port

22 Useful Information Vim에 색깔도 없고.. Indentation도 자동으로 안돼요 ㅜㅅㅜ..
.vimrc 파일은 vim이 실행될 때 마다, 색깔, indent등에 관련된 설정을 적용해 줌! 만들기 귀찮으니까 그냥 가져다 쓰세요~ $ cp /home/pipoket/.vimrc ~/ $ cp –r /home/pipoket/.vim ~/


Download ppt "Introduction to Django"

Similar presentations


Ads by Google