Django REST API with React App step-by-step

I use PyCharm for python projects and pipenv for package management. Start new PyCharm project named django-rest-react-blog Optionally git init clone gist .gitignore for Django and React projects Main course pipenv install django pipenv install djangorestframework pipenv install ipython --dev django-admin.py startproject bookcase cd bookcase python manage.py startapp mainapp Edit bookcase/settings.py: ... INSTALLED_APPS = [ ... 'rest_framework' ] ... TEMPLATES = [ { ... 'DIRS': [BASE_DIR / 'mainapp-ui/build'], ... }, ] ... STATIC_ROOT = BASE_DIR / 'static' STATICFILES_DIRS = ( (BASE_DIR / 'mainapp-ui/build/static'), ) Edit mainapp/views.py: from django.shortcuts import render def index(request): return render(request, 'index.html', {}) Edit bookcase/urls.py: ... from mainapp.views import index urlpatterns = [ ... path('', index) ] make dir mainapp/api with files there: ...

<span title='2021-02-27 00:00:00 +0000 UTC'>February 27, 2021</span>

The backup connection between the two branches

A tunnel is organized between the two branches via the ISP. For redundancy, a second tunnel is organized over the network of another ISP. Scheme with IP-addresses: Switching to the backup route is performed when OSPF connectivity is lost through the tunnel over the network of the ISP “A”. BFD is used to quickly evaluate connectivity. The settings for routers: Router WEST hostname WEST no ip domain lookup interface Loopback0 no shutdown description PC_A ip address 172.16.1.1 255.255.255.0 interface Tunnel0 no shutdown ip address 172.16.12.1 255.255.255.252 bfd interval 50 min_rx 50 multiplier 3 tunnel source 10.1.1.1 tunnel destination 10.2.2.1 interface Tunnel1 no shutdown description RESERV ip address 172.16.21.1 255.255.255.252 ip ospf cost 1500 bfd interval 50 min_rx 50 multiplier 3 tunnel source 10.3.3.1 tunnel destination 10.4.4.1 interface GigabitEthernet0/0 no shutdown description to_ISP_A ip address 10.1.1.1 255.255.255.252 duplex auto speed auto media-type rj45 interface GigabitEthernet0/1 no shutdown description to_ISP_B ip address 10.3.3.1 255.255.255.252 duplex auto speed auto media-type rj45 router ospf 1 log-adjacency-changes detail network 172.16.1.0 0.0.0.255 area 0 network 172.16.12.0 0.0.0.3 area 0 network 172.16.21.0 0.0.0.3 area 0 bfd all-interfaces ip route 10.2.2.0 255.255.255.252 10.1.1.2 ip route 10.4.4.0 255.255.255.252 10.3.3.2 line con 0 exec-timeout 0 0 logging synchronous Router EAST ...

<span title='2021-02-14 00:00:00 +0000 UTC'>February 14, 2021</span>

First acquaintance with EVE-NG

I got acquainted with the emulated vitrual environment EVE-NG. The image with EVE for VMware (OVF version) and all the necessary utilities can be downloaded from the official website eve-ng.net. Images of devices are easy to find with Google or on the official websites of manufacturers. For example, for mikrotik. You can add your own images in this way (for example, Cisco router and switch images and the windows client side for EVE-NG): ...

<span title='2021-02-13 00:00:00 +0000 UTC'>February 13, 2021</span>

Facial recognition with Python

I tried the facial recognition library for Python ageitgey/face_recognition. This library uses dlib, a toolkit written in C++ that contains machine learning algorithms. For example, I’m trying to check if an actor is playing in the TV series “The Big Bang Theory”. A test image with an actor is compared to real actors filmed in a TV show. I wrote a web service that uses python face_recognition library for face recognition from image and compares the recognized face with the data stored in the database. ...

<span title='2021-01-18 00:00:00 +0000 UTC'>January 18, 2021</span>

First acquaintance with react

I wrote a traditional application for such kind of training cases in React. This is a simple to-do list. In my app, I don’t use any extensions for state management. Only clean React with state saving in local storage. I spied the main ideas on the Udemy course “React + Redux. Professional development”. But mostly I tried to write the code myself. I would like to dive into React Native a bit and migrate this app to Android. But it depends on the availability of free time. ...

<span title='2020-11-29 00:00:00 +0000 UTC'>November 29, 2020</span>

Debian in VMware Workstation Player

For the needs of pet projects, I installed Debian in the VMware Workstation Player running on Windows. First of all, I met some common problems. I write here the steps to solve them. 1. ‘Username’ is not in the sudoers file. $ su - # visudo add row 'Username' ALL=(ALL:ALL) ALL where ‘Username’ is your username and save 2. The graphics environment does not support the screen resolution you need. Command to display the supported resolutions and name of your video output. ...

<span title='2020-11-01 00:00:00 +0000 UTC'>November 1, 2020</span>

Cisco command 'history'

Starting from IOS 15.1 cisco command history is appeared. It outputs a pretty nice ASCII diagram of interfaces loading. For enable: (config)# interface GigabitEthernet 0/1 (config-if)# history bps Now you can see the result using the command: # show interface GigabitEthernet 0/1 history 60sec input The different periods (60sec, 60min, 72hour) and different traffic directions (input, output, both) are available.

<span title='2020-09-24 00:00:00 +0000 UTC'>September 24, 2020</span>

Message 'Native VLAN mismatch discovered'

Do you need to mix traffic between different VLANs without any limits and configuration settings? The best way is to inject a hub between access ports on switch and customers. This is actually a joke. But, unfortunately, this is possible, and there is no way to hope for the STP. The first thing that should alert you is the repeated messages "%CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on…" if CDP is enabled. A hundred percent confirmation is the duplication of mac addresses for all VLAN interfaces. ...

<span title='2020-09-23 00:00:00 +0000 UTC'>September 23, 2020</span>

Start Ansible for Docker containers

For some pet projects, I need multiple instances of different servers. The best way is to use Docker. And the best way to automate configuration services that run in docker containers is Ansible. This is the sequence of steps to run Ansible to configure containerized services in Ubuntu. Installing Docker Engine on Ubuntu is very well described on the official website. A summary of the steps: sudo apt-get update sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io sudo docker run hello-world The last command is used to verify successful installation. ...

<span title='2020-09-19 00:00:00 +0000 UTC'>September 19, 2020</span>

Watchdog for folder changes with golang

I recently wrote a Python script to log changes in the selected folder. The script has a GUI based on Tkinter, the native Python library. I decide to rewrite this script in the Golang. I only need one executable file that doesn’t require Python installation. Before that, I made an executable file using pyinstaller. But why not try Golang? Apart from Tkinter, I only know a little about the GTK. I used it for a new version of the program written in Golang with a GUI. ...

<span title='2020-09-05 00:00:00 +0000 UTC'>September 5, 2020</span>