Smart Map In Python Tutorial Series - Installing Python Django in a Virtual Environment

EBISYS Tech
0
Welcome to the Smart Map In Python Tutorial Series. In the previous tutorial we were installing and configuring PostgreSQL and PostGIS. We also created a PostgreSQL database and a user for that database. Afterwards we added PostGIS extensions to enable the database to store spatial data.

In this tutorial we'll be looking at installing some essential python development tools, and installing python tools for creating our virtual environment. After creating our virtual environment we are going to install Python 3 django inside that environment.

If you want to check out the video, click on the link below. Remember to Like and Subscribe and hit the Notification button to make sure you're aware of the latest video we will publish.

Smart Map in Python Tutorials - Installing Python Django in a Virtual Environment (Video)

Bubble plot on open street map

Step 1: Open your Ubuntu Linux Terminal

Press CTRL + ALT + T

Step 2: Switch to root user account

~$ sudo bash


Step 3: Verify that python 3 is installed

~$ python3 --version


Step 4: Install python 3 pip

~$ sudo apt-get install python3-pip

Step 5: Install some essential tools for python development

~$ sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

Step 6: Install python 3 venv

~$ sudo apt-get install python3-venv

Step 7: Change directory into our desktop

~$ cd ~/Desktop/

Step 8: Create our EBISYS-Tutorials directory on your desktop

~$ mkdir EBISYS-Tutorials

Step 9: Change directory into our EBISYS-Tutorials folder

~$ cd EBISYS-Tutorials

Step 10: Create our WaterWatch project folder

~$ mkdir WaterWatch

Step 11: Let's create our virtual environment, and call it venv

~$ pyvenv venv

Step 12: Activate our virtual environment

~$ source venv/bin/activate

comment: when you see the (venv) prefix, it means our virtual environment has been activated and that we are working within our virtual environment.

To deactivate our virtual environment simply type: 
~$ deactivate

Step 13: Inside our virtual environment, install django toolbelt which will install django and other libraries to support our django development.

~$ pip install django-toolbelt

Step 14: Create a requirements.txt file with a list of our python external dependency libararies

~$ pip freeze > requirements.txt

Step 15: Check if our django dependencies are listed in our requirements.txt file

~$ cat requirements.txt

Conclusion

That is about all we need to cover for the python django installation in a virtual environment. I hope you will enjoyed it and it will add some value to the projects you are currently busy with.

Stay tuned for the next tutorial in the Smart Map in Python Tutorial Series where we will be installing and configuring our ATOM IDE.







Post a Comment

0Comments
Post a Comment (0)