Installations
Learn how to install the different libraries, frameworks, and tools used in this course on your machine.
We'll cover the following...
Installing Django
There are two ways to install packages in Python. You can easily just run:
pip install package_name
Alternatively, you can write the package name with the version in a text file.
Note:Â This section is only required if you are creating the project locally on your machine.
Just know that there can be some differences between the version and it can affect your project.
Create a file named requirements.txt
at the root of the django-api
directory and add the Django package name:
Django==4.0
Now, run the following command to install Django:
pip install -r requirements.txt
Installing Postgres
Note:Â This section is only required if you are creating the project locally on your machine.
Depending to your OS, you can download different Postgres versions on the Postgres website. In this course, we are working with PostgreSQL 14.
Once you have installed Postgres from the link above, install a PostgreSQL adapter for Python, psycopg
:
pip install psycopg2-binary
Don’t forget to add this to the requirements.txt
file:
Django==4.0psycopg2_binary==2.9.2
Installing Django Rest Framework and JWT authentication plugin
Note:Â This section is only required if you are creating the project locally on your machine.
The DRF package can be installed with this command:
pip install djangorestframework django-filter
Don’t forget to add the following to the requirements.txt
file:
Django==4.0psycopg2_binary==2.9.2djangorestframework==3.13.1django-filter==21.1