Season 1 아카이브/프로그래밍
                
              Anaconda for Windows와 Django 설치
                문장전달자
                 2016. 2. 11. 15:17
              
              
                    
        728x90
    
    
  1. Windows Anaconda 설치
https://www.continuum.io/downloads
2. 가상환경 설정
1 2 3 4 5  | C:\Users\fukaeri>mkdir haskel C:\Users\fukaeri>cd haskel C:\Users\fukaeri\haskel>python3 -m venv envhaskel C:\Users\fukaeri\haskel>envhaskel\Scripts\activate (envhaskel) C:\Users\fukaeri\haskel>  | cs | 
3. 장고 설치
1) 설치된 장고 확인 - 아래에서 보다시피 django 라는 모듈이 없다.
1 2 3 4 5 6 7 8 9  | (envhaskel) C:\Users\fukaeri>python Python 3.5.1 |Anaconda 2.5.0 (32-bit)| (default, Jan 29 2016, 15:46:01)  [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import django Traceback (most recent call last):   File "<stdin>", line 1, in <module> ImportError: No module named 'django' >>> exit()  | cs | 
2) 장고 설치 (1.9.2 버전)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | (envhaskel) C:\Users\fukaeri>pip install django==1.9.2 Collecting django==1.9.2   Downloading Django-1.9.2-py2.py3-none-any.whl (6.6MB)     100% |################################| 6.6MB 36kB/s Installing collected packages: django Successfully installed django-1.9.2 (envhaskel) C:\Users\fukaeri>python Python 3.5.1 |Anaconda 2.5.0 (32-bit)| (default, Jan 29 2016, 15:46:01)  [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import django >>> print(django.get_version()) 1.9.2 >>>  | cs | 
3) 프로젝트 생성 
1 2 3 4 5 6 7 8 9  | (envhaskel) C:\Users\fukaeri\haskel>django-admin startproject mysite . haskel ├───manage.py └───mysite         settings.py         urls.py         wsgi.py         __init__.py  | cs | 
여기서 .은 현재 디렉토리에 프로젝트를 생성하라는 뜻이다.
위의 settings.py 을 다음과 같이 수정한다.
1 2  | STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static')  | cs | 
데이터베이스 연결설정 및 마이그레이션 등은 아래 게시물을 참조한다.
파이썬, 장고, 그리고 오라클 데이터베이스 연결하기 (1)
http://www.antilibrary.org/700
5) 실행
1  | (envhaskel) C:\Users\fukaeri\haskel>python manage.py runserver  | cs | 
정상적으로 설치된 것을 확인할 수 있다.
728x90