Django is a framework use to build the backend of a Web Application. Django is written in Python programing language.
Framework: A framework is a structure that allows you build software on. It serves as a foundation, so you
don't have to write every code from scratch.
Websites that use Django
Below are the list of popular websites that use Django
- Mozila
- DropBox
- YouTube
- Spotify
Download Miniconda
Since Django is written in Python you need to install python first, there are various ways of installing Python in your Windows Machine, We are choosing to install Python via the Miniconda Distribution, click on the link here to download miniconda. On that page you can see the two versions of miniconda for Windows (Miniconda3 Wondows 64-bit and Miniconda3 Windows 32-bit), you can download the version of Miniconda that corresponds to your Windows OS architecture as seen in the screenshot below.
Install Miniconda
After Miniconda have been downloaded you can click on the installation file to install Miniconda
Click on the next button as seen on the screenshot below
Click on "I Agree"
Click on "Just Me"
Click on "Next"
Advance Options
Click "Add Miniconda to my PATH environment variable"
This is a very important step as it will allow to run Python anywhere in your computer systen.
Click "Install"
Test your Miniconda Installation
On Windows Search type "cmd"
cmd screen will popup as seen below
Microsoft Windows [Version 10.0.19042.1826]
(c) Microsoft Corporation. All rights reserved.
C:\Users\DELL PC>
Type conda and press enter
Options:
positional arguments:
command
clean Remove unused packages and caches.
config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (C:\Users\DELL PC\.condarc) by
default.
create Create a new conda environment from a list of specified packages.
help Displays a list of available conda commands and their help strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The input is a MatchSpec, a query language for conda packages. See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
env
(base) C:\Users\DELL PC>
The message above indicates that mini conda is installed successfully
A Virtual Environment
A virtual environment allows you to isolate the installation of different versions of Python and its packages (Django can also be referred to as a Python Package). You can install or remove a python package on one project and it will not affect any other project you may have.
Creating a Virtual Environment
The syntax for creating a virtual environment is shown below
conda create --name name_of_env python==version_number
conda, create, --name are keywords while name_of_env can be anything you want to use to identify the name of your virtual environment, python is also a keyword version_number is the version of Python you are installing in a particular virtual environment, It is important to note that the syntax can be written without specifying the Version Number of Python, when the syntax is written as seen below it installs the latest version of Python in that Virtual Environment
conda create --name name_of_env
Launch your command prompt to type the command below and then press enter
conda create --name my_ecommerce_env python==3.7
Type "y" to continue
==> WARNING: A newer version of conda exists. <==
current version: 4.8.3
latest version: 4.13.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: C:\Users\DELL PC\.conda\envs\my_ecommerce_env
added / updated specs:
- python==3.7
The following NEW packages will be INSTALLED:
certifi pkgs/main/win-64::certifi-2022.6.15-py37haa95532_0
pip pkgs/main/win-64::pip-22.1.2-py37haa95532_0
python pkgs/main/win-64::python-3.7.0-hea74fb7_0
setuptools pkgs/main/win-64::setuptools-61.2.0-py37haa95532_0
vc pkgs/main/win-64::vc-14.2-h21ff451_1
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
wincertstore pkgs/main/win-64::wincertstore-0.2-py37haa95532_2
Proceed ([y]/n)? y
To activate your virtual environment run the command below
C:\Users\DELL PC>conda activate my_ecommerce_env
(my_ecommerce_env) C:\Users\DELL PC>
The virtual environment name in parenthesis (my_ecommerce_env) indicates that the virtual environment is activated
To verify the version of python in your virtual environmment run the command below
(my_ecommerce_env) C:\Users\DELL PC>python --version
Python 3.7.0
To deactivate your virtual environment run the command below
(my_ecommerce_env) C:\Users\DELL PC>conda deactivate
To list out all virtual envronment in your system type the command below
C:\Users\DELL PC>conda info --envs
my_ecommerce_env C:\Users\DELL PC\.conda\envs\my_ecommerce_env
nneka_python C:\Users\DELL PC\.conda\envs\nneka_python
paminas C:\Users\DELL PC\.conda\envs\paminas
phsaid C:\Users\DELL PC\.conda\envs\phsaid
The above screen shows a list of all the Virtual Environment you have on your Computer System and that is all for now checkout the complete tutorials here
Comments (1)
-
Great explanation! Way to go.
Leave a Reply
Your email address will not be published. Required fields are marked *