This page looks best with JavaScript enabled

Django Updates

 ·  🎃 kr0m

It is as important to develop code as it is to keep it updated. If we don’t, the possibility of exploitation by an attacker will increase day by day. In this article, we will explain how to update everything related to the rxWod project, that is, the operating system, installed software, Python code, and JavaScript code.

Before we begin, it is recommended to read the previous articles on Django as they are the previous steps to this article:


Let’s start with the OS source code, base tools, and kernel:

freebsd-update fetch
freebsd-update install

Installed packages:

pkg upgrade
pkg autoremove


We install Rust since it is a dependency of some Python libraries:

pkg install rust

Activate the venv, update PIP, install the wheel dependency and pip-upgrader:

cd /home/kr0m/rxWod
source bin/activate
cd rxWodProject/
python3.7 -m pip install –upgrade pip
pip install wheel
pip install pip-upgrader
pip freeze > requirements.txt

Update Python libraries:

pip-upgrade

It will show an output similar to the following:

Found valid requirements file(s)requirements.txt  
1/28: asgiref ... up to date: 3.3.1  
2/28: attrs ... up to date: 20.3.0  
3/28: autobahn ... upgrade available: 20.12.3 ==> 21.3.1 (uploaded on 2021-03-02 15:12:15)  
4/28: Automat ... up to date: 20.2.0  
5/28: cffi ... upgrade available: 1.14.4 ==> 1.14.5 (uploaded on 2021-02-11 20:59:36)  
6/28: constantly ... up to date: 15.1.0  
7/28: cryptography ... upgrade available: 3.3.1 ==> 3.4.7 (uploaded on 2021-03-25 17:40:10)  
8/28: daphne ... up to date: 3.0.1  
9/28: Django ... upgrade available: 3.1.4 ==> 3.1.7 (uploaded on 2021-02-19 09:08:09)  
10/28: django-modeltranslation ... upgrade available: 0.16.1 ==> 0.16.2 (uploaded on 2021-02-18 07:44:23)  
11/28: django-webpack-loader ... up to date: 0.7.0  
12/28: hyperlink ... upgrade available: 20.0.1 ==> 21.0.0 (uploaded on 2021-01-08 05:51:22)  
13/28: idna ... upgrade available: 3.0 ==> 3.1 (uploaded on 2021-01-04 16:20:02)  
14/28: incremental ... upgrade available: 17.5.0 ==> 21.3.0 (uploaded on 2021-03-02 01:59:36)  
15/28: psycopg2 ... up to date: 2.8.6  
16/28: pyasn1 ... up to date: 0.4.8  
17/28: pyasn1-modules ... up to date: 0.2.8  
18/28: pycparser ... up to date: 2.20  
19/28: PyHamcrest ... up to date: 2.0.2  
20/28: pyOpenSSL ... up to date: 20.0.1  
21/28: pytz ... upgrade available: 2020.4 ==> 2021.1 (uploaded on 2021-02-01 08:07:15)  
22/28: service-identity ... up to date: 18.1.0  
23/28: six ... up to date: 1.15.0  
sqlite3==0.0.0 API error: Not Found  
25/28: sqlparse ... up to date: 0.4.1  
26/28: Twisted ... upgrade available: 20.3.0 ==> 21.2.0 (uploaded on 2021-02-28 10:03:55)  
27/28: txaio ... upgrade available: 20.12.1 ==> 21.2.1 (uploaded on 2021-02-20 14:35:11)  
28/28: zope.interface ... upgrade available: 5.2.0 ==> 5.3.0 (uploaded on 2021-03-21 09:49:13)  
  
Available upgrades:  
+------+---------------------------+-----------------+----------------+---------------------+  
| No.  | Package                   | Current version | Latest version | Release date        |  
+------+---------------------------+-----------------+----------------+---------------------+  
|  1   |  autobahn                 | 20.12.3         | 21.3.1         | 2021-03-02 15:12:15 |  
|  2   |  cffi                     | 1.14.4          | 1.14.5         | 2021-02-11 20:59:36 |  
|  3   |  cryptography             | 3.3.1           | 3.4.7          | 2021-03-25 17:40:10 |  
|  4   |  Django                   | 3.1.4           | 3.1.7          | 2021-02-19 09:08:09 |  
|  5   |  django-modeltranslation  | 0.16.1          | 0.16.2         | 2021-02-18 07:44:23 |  
|  6   |  hyperlink                | 20.0.1          | 21.0.0         | 2021-01-08 05:51:22 |  
|  7   |  idna                     | 3.0             | 3.1            | 2021-01-04 16:20:02 |  
|  8   |  incremental              | 17.5.0          | 21.3.0         | 2021-03-02 01:59:36 |  
|  9   |  pytz                     | 2020.4          | 2021.1         | 2021-02-01 08:07:15 |  
|  10  |  Twisted                  | 20.3.0          | 21.2.0         | 2021-02-28 10:03:55 |  
|  11  |  txaio                    | 20.12.1         | 21.2.1         | 2021-02-20 14:35:11 |  
|  12  |  zope.interface           | 5.2.0           | 5.3.0          | 2021-03-21 09:49:13 |  
+------+---------------------------+-----------------+----------------+---------------------+

We indicate that we want to update all packages:

Please choose which packages should be upgraded. Choices: "all", "q" (quit), "x" (exit) or "1 2 3"  
Choice: all

If we want to update non-interactively, we just need to indicate it as follows:

pip-upgrade -p all


Now it’s time for the JavaScript libraries, we make sure that all libraries are installed:

yarn install –force

yarn install v1.22.10  
info No lockfile found.  
[1/4] Resolving packages...  
[2/4] Fetching packages...  
[3/4] Linking dependencies...  
[4/4] Rebuilding all packages...  
success Saved lockfile.  
Done in 0.03s.

We update the libraries:

yarn upgrade

It will show an output similar to the following:

yarn upgrade v1.22.10
[1/4] Resolving packages…
[2/4] Fetching packages…
[3/4] Linking dependencies…
[4/4] Rebuilding all packages…
success Saved lockfile.
success Saved 0 new dependencies.
Done in 0.03s.

We compile the WebPack bundles:

yarn prod-build

If it is a Jail under Iocage we will use the following script .

If you liked the article, you can treat me to a RedBull here