(1) 장고 설치

pip install django


(2) 장고 애플리케이션 서버 실행 및 애플리케이션 실행

http://www.joinc.co.kr/modules/moniwiki/wiki.php/Site/Python/DJango/Tutorial01

* 유의할 점

A. urls.py를 수정하고 나면 서버를 다시 실행해야 한다.

B. 3.4 URLconf 설정 시에 잘못된 것이 하나 있어서 고생했다.

아래 코드와 함께 빨간색으로 표시해 두었다.

# cat views.py import datetime from django.http import HttpResponse def hello(request): return HttpResponse("Hello world") def index(request): return HttpResponse("Home page") def currenttime(request): d = datetime.datetime.now() return HttpResponse("Current Time : {0}".format(d)) # cat from django.conf.urls import patterns, include, url from testapp.views import hello, index, currenttime urlpatterns = patterns('', url(r'^$', index), url(r'^currnettime/$', currenttime), url(r'^hello/$', hello) )


(3) 외부 접속

0.0.0.0:8080 그래도 써야 한다.

python manage.py runserver 0.0.0.0:8080


(4) html 으로 실행 가능하게 수정

http://10apps.tistory.com/54

어쨌든 성공!!


흠.. 이건 반만의 성공인 것 같다.

post와 request가 되야 해서 아래 글을 봐야겠다.

http://greenfishblog.tistory.com/category/django

http://simpleisbest.tistory.com/category/프로그래밍/Django



Posted by 공놀이나하여보세
,