Here's how to install Django on a clean Windows 10.
** Introduction Python. ** **
For Python on Windows 10, it's a good idea to download the official installer. Leave your hands on Anaconda.
The Python version uses ** 3 series **.
The latest version of this article when building the environment is 3.7.4 Download from the bottom of the site below according to your environment. https://www.python.org/downloads/windows/
I selected the installer for 64-bit environment.
Install the downloaded one. At this time, I checked the option to pass the PATH. I think it is off by default.
Launch PowerShell for Windows 10 and check the Python version. Windows can use both python and py. It seems that the latest version of py is specified.
PS C:\Users\AKI> python --version
Python 3.7.4
PS C:\Users\AKI\django_proj> py --version
Python 3.7.4
** In this article, Django is built using a Python virtual environment. ** **
A virtual environment is a ** virtual closed space ** that helps keep your computer clean with various Python packages.
** Run Django in this virtual environment. ** **
Create a directory anywhere you like with PowerShell. This time I will make it in my HOME. After creating the directory, move to it.
PS C:\Users\AKI> mkdir django_proj
PS C:\Users\AKI> cd .\django_proj\
PS C:\Users\AKI\django_proj>
Build a virtual environment with something called venv.
It seems that virtualenv was used at the time of Python 2 series, but it becomes venv in 3 series and it is in Pyhon by default.
Let's build it. Here, the name of the virtual environment is "env01".
PS C:\Users\AKI\django_proj> python -m venv env01
PS C:\Users\AKI\django_proj> ls
env01 <-This folder is created
Then, ** execute activate in the Scripits folder ** to enter the virtual environment.
PS C:\Users\AKI\django_proj> .\env01\Scripts\activate
(env01) PS C:\Users\AKI\django_proj>
(Env01) is displayed at the beginning of the Shell.
** You are now in a virtual environment. ** **
Again, check your Python version.
(env01) PS C:\Users\AKI\django_proj> python --version
Python 3.7.4
Deploy using pip in a virtual environment.
"Pip" is a system that manages Python libraries and packages. If a beginner puts in Anaconda and does it properly, the package will interfere with pip and the local environment will be chaotic without knowing it.
First, upgrade to the latest version of pip.
(env01) PS C:\Users\AKI\django_proj> python -m pip install --upgrade pip
Enter the command to install.
(env01) PS C:\Users\AKI\django_proj> pip install Django
.
.Various logs flow here
.
Successfully installed Django-2.2.3 pytz-2019.1 sqlparse-0.3.0
Check your Django version.
(env01) PS C:\Users\AKI\django_proj> django-admin --version
2.2.3
By the way, let's launch another Poser Shell here and check the version of Django there.
PS C:\Users\AKI> django-admin --version
It is said that there is no such command.
** I was able to build Django only in a virtual environment. ** **
To exit the virtual environment, enter the command as shown below.
(env01) PS C:\Users\AKI\django_proj> deactivate
PS C:\Users\AKI\django_proj>
** Returned to reality. ** **
That's it for building the Django environment.
The next step is Tutorial.