1. 프로젝트 생성

cd /root
mkdir django
cd django
cp /usr/lib/python2.7/dist-packages/django/bin/django-admin.py .
python django-admin.py startproject FIRST

 → 위의 명령어을 정상적으로 수행했다면 아래와 같은 구조의 디렉토리가 생셩되게 됩니다.

root@ubuntu:~/django# ls -R FIRST
FIRST:
__init__.py  __init__.pyc  manage.py  settings.py  settings.pyc  urls.py  urls.pyc

 

2. DB생성

root@ubuntu:~/django# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.29-0ubuntu0.12.04.2 (Ubuntu)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database board;

 

3. DB 및 환경설정

root@ubuntu:~/django/FIRST# vi settings.py

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',         # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'board',                                        # Or path to database file if using sqlite3.
        'USER': 'root',                                           # Not used with sqlite3.
        'PASSWORD': '설정하고싶은 비밀번호',      # Not used with sqlite3.
        'HOST': 'localhost',                                   # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '3306',                                          # Set to empty string for default. Not used with sqlite3.
    }
}

TIME_ZONE = 'Asia/Seoul'

→ 위와 같이 DB정보와 함께 TIME_ZONE을 설정하도록 합니다.

 

4. DB 동기화

root@ubuntu02:~/django/FIRST# python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site

 

5. 서비스 시작

root@ubuntu:~/django/FIRST# python manage.py runserver 0.0.0.0:80
Validating models...

0 errors found
Django version 1.3.1, using settings 'board.settings'
Development server is running at http://0.0.0.0:80/
Quit the server with CONTROL-C.

 

6. 서비스 확인

위의 사진이 보인다면 정상적으로 세팅이 된것입니다. 안되었다면 연락주세요..

'DJANGO' 카테고리의 다른 글

DJANGO #6. Template 적용하기  (0) 2013.05.17
DJANGO #5. 어플생성 및 기본 작동 방법 설명  (0) 2013.04.05
DJANGO #3. Python, Django 설치  (0) 2013.04.03
DJANGO #2. Tutorial 설명  (0) 2013.04.03
DJANGO #1. Django 정의 및 특징  (0) 2013.04.03

+ Recent posts