본문 바로가기

Django

Django, 가상환경 설치

반응형

 

Quick install guide | Django documentation | Django

Quick install guide ¶ Before you can use Django, you’ll need to get it installed. We have a complete installation guide that covers all the possibilities; this guide will guide you to a minimal installation that’ll work while you walk through the introduction. Install Python ¶ Being a Python web fra...

docs.djangoproject.com

- 일단은 Python이 가진 기본 DB인 SQLite를 이용하자.

- 현재 설치된 Version 확인

python3
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 

2. 가상환경 설치

- 각 프로젝트 별로 Library Dependancy가 다르기도 하고 버전이 다르기도 하고 호환성에 문제가 발생할 수 도 있어서 가상환경을 이용하여 각 프로젝트를 관리하도록 한다.

$python -m env env
$source env/bin/activate
 
 

- 가상 환경 접속 및 python version 확인

source activate
(env) django/env/bin$ python
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
(env) django/env/bin$ 
 

- pip list 명령으로 환경 확인하기

pip list
Package         Version
--------------- ---------
asgiref         3.3.1
certifi         2020.12.5
chardet         4.0.0
cycler          0.10.0
Django          3.1.4
idna            2.10
kiwisolver      1.3.1
lxml            4.6.2
matplotlib      3.3.4
multitasking    0.0.9
numpy           1.20.1
pandas          1.2.2
Pillow          8.0.1
pip             20.3.3
pyparsing       2.4.7
python-dateutil 2.8.1
pytz            2020.5
requests        2.25.1
scipy           1.6.1
seaborn         0.11.1
setuptools      51.1.1
six             1.15.0
sqlparse        0.4.1
urllib3         1.26.3
wheel           0.36.2
yfinance        0.1.55
WARNING: You are using pip version 20.3.3; however, version 21.3.1 is available.
 

- 가상환경 빠져 나오기

$ deactivate
 

 

 

반응형

'Django' 카테고리의 다른 글

Django Template을 이용한 html 호출  (0) 2022.02.08
Django Project Setup  (0) 2022.02.08
Django App 만들기  (0) 2022.02.08
Django 프로젝트 만들기 및 서버 기동  (0) 2022.02.08
Django sqlite3 기초  (0) 2022.02.08