윈도우즈에 Django 설치하기¶
이 문서에서는 윈도우즈에 파이썬 3.5와 Django를 설치하는 법을 안내할 것입니다. 파이썬 프로젝트를 좀 더 쉽게 작업하게 해주는 virtualenv와 virtualenvwrapper 설치에 대한 안내도 제공합니다. Django를 사용하는 초보자들을 위한 가이드이며 Django가 어떻게 설치되어야 하는지에 대한 내용은 아닙니다.
이 가이드 내용은 윈도우즈 7, 8, 10에서 테스트했습니다. 다른 버전에서도 각 단계는 유사할 것입니다. 가이드를 따라오기 위해서 윈도우즈 커맨드 프롬프트에 친숙해질 필요가 있습니다.
파이썬 설치¶
Django는 파이썬 웹 프레임워크이므로 설치를 위해서는 파이썬이 필요합니다. 이 글을 쓰는 시점을 기준으로 파이썬 최신판은 3.5입니다.
컴퓨터에 파이썬을 설치하기 위해 https://python.org/downloads/에 가시기 바랍니다. 이 사이트에서 다운로드 버튼을 이용해서 최신판 파이썬을 받을 수 있습니다. 실행가능한 설치 파일을 받아서 실행하세요. Add Python 3.5 to PATH
옆의 체크 박스를 클릭하고 설치를 시작하세요.
설치 후에는 커맨드 프롬프트를 열어서 설치된 파이썬 버전과 방금 설치한 파이썬 버전이 같은지 확인하세요.
python --version
pip
에 대하여¶
pip is a package manage for Python. It makes installing and uninstalling
Python packages (such as Django!) very easy. For the rest of the installation,
we'll use pip
to install Python packages from the command line.
To install pip on your machine, go to
https://pip.pypa.io/en/latest/installing/, and follow the Installing with
get-pip.py
instructions.
Install virtualenv
and virtualenvwrapper
¶
virtualenv and virtualenvwrapper provide a dedicated environment for each Django project you create. While not mandatory, this is considered a best practice and will save you time in the future when you're ready to deploy your project. Simply type:
pip install virtualenvwrapper-win
Then create a virtual environment for your project:
mkvirtualenv myproject
The virtual environment will be activated automatically and you'll see "(myproject)" next to the command prompt to designate that. If you start a new command prompt, you'll need to activate the environment again using:
workon myproject
장고 설치¶
Django can be installed easily using pip
within your virtual environment.
In the command prompt, ensure your virtual environment is active, and execute the following command:
pip install django
This will download and install the latest Django release.
After the installation has completed, you can verify your Django installation
by executing django-admin --version
in the command prompt.
See 데이터베이스 구동 for information on database installation with Django.
Common pitfalls¶
If
django-admin
only displays the help text no matter what arguments it is given, there is probably a problem with the file association in Windows. Check if there is more than one environment variable set for running Python scripts inPATH
. This usually occurs when there is more than one Python version installed.If you are connecting to the internet behind a proxy, there might be problem in running the command
pip install django
. Set the environment variables for proxy configuration in the command prompt as follows:set http_proxy=http://username:password@proxyserver:proxyport set https_proxy=https://username:password@proxyserver:proxyport