|
Django 공식사이트나 Django Book 사이트에도 잘 정리되어 있지만,
다시한번 처음부터 설치/설정 하는 법을 정리해보았다. 1. Django 설치 # apt-get install python-django 2. Apache + mod_python 설치 # apt-get install libapache2-mod-python 3. 프로젝트 생성 $ mkdir -p /opt/project/web $ cd /opt/project/web $ django-admin startproject 프로젝트이름 4. 템플릿 디렉토리 설정 $ cd 프로젝트이름 $ mkdir templates settings.py : TEMPLATE_DIRS = ( os.path.join(os.path.dirname(__file__), 'templates'), ) 5. 어플리케이션 생성 $ cd /opt/project/web/프로젝트이름 $ python manage.py startapp 어플리케이션이름 6. URL 설정 (urls.py) from 프로젝트이름.어플리케이션이름.views import * urlpatterns = patterns('', (r'^$', index), ) 7. View 작성 $ cd /opt/project/web/프로젝트이름/어플리케이션이름 $ vi views.py from django.shortcuts import render_to_response from django.template import RequestContext def index(request): return render_to_response( 'index.html', ) 8. 템플릿 작성 $ cd /opt/project/web/프로젝트이름/templates $ vi index.html <html> <head><title>The First Page</title></head> <body><h1>The First Page : Success ^^</h1></body> </html> 9. Apache 설정 # cd /etc/apache2/sites-available # vi 프로젝트이름 NameVirtualHost 아이피:80 <Virtualhost 아이피:80> ServerName 도메인주소 DocumentRoot /opt/project/web <Location> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE 프로젝트이름.settings PythonDebug On PythonPath "['/opt/project/web'] + sys.path" </Location> <Location "/css"> SetHandler None </Location> </Virtualhost> # a2ensite 프로젝트이름 10. 이제, 아파치를 재시작하고 웹브라우즈에서 http://도메인이름 을 입력해보자.
나중에 python 2.x 에서 python 3.x 로 변경하기 위해서는 2.6 버전을 이용하는 것이 좋다고 합니다. 3.x 로 가기 위한 중간 버전인것이죠. 그런데, Ubunbu 8.04 에서는 python 2.5.2 가 설치되어 있어서, 별도로 설치해주어야 합니다. 여기에서는 python 2.6.2 final 버전을 설치하겠습니다.
현재 파이썬 버전을 확인 합니다. $ python -V Python 2.5.2 우선 빌드를 위한 기본 패키지를 설치합니다. $ sudo -i # apt-get install build-essential 파이썬 소스를 다운로드 받습니다. # cd /usr/local/src # wget http://python.org/ftp/python/2.6.2/Python-2.6.2.tgz 파이썬 소스를 풀고, 빌드/설치합니다. # tar xvfz Python-2.6.2.tgz # cd Python-2.6.2 # ./configure # make; make install /usr/local/bin 에 가서 확인해보면 python 2.6 이 설치된 것을 볼 수 있습니다. 마지막으로 다시 현재 파이썬 버전을 확인해봅니다. # python -V Python 2.6.2 어때요, 쉽지요? 그리 어려운 작업은 아니었습니다. *^^*
|
카테고리
태그
Ubuntu8.04
우분투
Adaptec
sun
postgresql
tomcat6
LSI
mod_rails
RAID
분류
IBM
Lenny
passenger
SuperMicro
ubuntu
apache2.2
ruby
후지쯔
HP
rails
Apache
django
데비안
python2.6.2
HotSpare
linux
squeeze
debian
스트럿츠2
DELL
최근 등록된 덧글
엔터프라이즈 급에서는 ..
by RIA at 04/16 제 말이요... 무슨 일.. by sk at 02/10 글쎄요... 현업입장에.. by 천하귀남 at 01/29 멋지네요. 건승하세요 by Yozz at 11/09 네... 열심히 찍어서 예.. by 가우리언 at 09/29 벨리를 스쳐지나가다 들.. by 술독에빠진고양이 at 09/29 해결되셨다니 잘 되었네.. by 가우리언 at 09/26 좋은 정보 감사합니다 ^.. by 명환 at 09/25 어제는 아주 간단하게(.. by 가우리언 at 05/18 역시 ext3가 불안한게 .. by 천하귀남 at 05/17 최근 등록된 트랙백
메모장
|