CHAPTER 1: (S-Ticketing) Installing Django
Hi developer, welcome to chapter 1 of building Support Ticketing in Django, if you haven’t known what this series is about please read chapter 0. In this post, we will be installing Django. Before we install Django we need to have python installed you can check this out if you haven’t installed Python yet. We also need virtual environment( not necessary but very important)
What is a virtual environment?
Virtual environment isolates your python or Django projects’ environment per project meaning each project will have its own environment, This is important, Imagine a situation where you have been using Django 2.2.1 for your projects then you get a contract and your teammates have been using Django 3.0 and now you have to use your same machine with your projects. To be tidy I would use a virtual environment to separate all the environments. We will use Virtual environment here
That said let us create a folder where our project will be. in windows, you can create a new folder anywhere you like same to Linux or use the command which creates and cd into the new folder
symons@symons-macbookair:~$ mkdir STICKETING symons@symons-macbookair:~$ cd STICKETING
After you are in the folder you should now open terminal or cd into that folder. Use the following command to create virtual environment called venv ( you can name it anything you like just change the second venv)
symons@symons-macbookair:~/STICKETING$ python3 -m venv venv
On windows:
python -m venv venv
The above command should create a folder in STICKETING directory. Now we need to activate our venv
symons@symons-macbookair:~/STICKETING$ source venv/bin/activate (venv) symons@symons-macbookair:~/STICKETING$
Windows
venv\Scripts\activate
You will know venv is activated when the next prompt is prefixed with (venv)
.
Installing Django
Now that we have isolated environment for our S-ticketing environment we can install Django in it. With venv activated let us update pip which is a package installer for python, it will help us install Django.
python -m pip install --upgrade pip
You should see output similar to the following
(venv) symons@symons-macbookair:~/STICKETING$ python -m pip install --upgrade pip Cache entry deserialization failed, entry ignored Collecting pip Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3 /pip-20.0.2-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 9.0.1 Uninstalling pip-9.0.1: Successfully uninstalled pip-9.0.1 Successfully installed pip-20.0.2
Now Install Django. You can leave the version to install the latest version pip install Django
pip install Django~=2.2.4
Results:
(venv) symons@symons-macbookair:~/STICKETING$ pip install Django~=2.2.4 Collecting Django~=2.2.4 Downloading Django-2.2.10-py3-none-any.whl (7.5 MB) |????????????????????????????????| 7.5 MB 123 kB/s Collecting sqlparse Using cached sqlparse-0.3.0-py2.py3-none-any.whl (39 kB) Collecting pytz Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB) Installing collected packages: sqlparse, pytz, Django Successfully installed Django-2.2.10 pytz-2019.3 sqlparse-0.3.0 (venv) symons@symons-macbookair:~/STICKETING$
Django is now installed let us check to confirm
(venv) symons@symons-macbookair:~/STICKETING$ django-admin --version 2.2.10
Done!
See you in chapter 2