Learn by doing

We will write a Sales Orders Management System using Django REST for the back-end, and React JS for the front-end. We will add authentication with JWT and will cover the back-end with tests.

We will also use the CDN version of React JS, not the “create-react-app”. This will simplify the development, as we WILL NOT need to run two servers: one for Django and one for React.

Of course, we will be using Functional Components in React.

Bonus: Sweet Alerts for beautiful animation :)

Takeaways: complete project source code on GitHub


  1. Create a Python Django Project

How much faster is your app with indexes?

A database index is like a phone book

Even “Senior” developers often forget to use indexes in Django. You can’t imagine how faster it can get if you simply add two lines of code into your model!

In this article we will take measurements together: with and without indexes.


Our patient will be a small Django application with just 7 fields.

I will just show the model here:

class Student(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
code0 = models.CharField(max_length=100, blank=True)
code1 = models.CharField(max_length=100, blank=True)
code2 = models.CharField(max_length=100, blank=True)
code3 = models.CharField(max_length=100, blank=True)
code4 = models.CharField(max_length=100, blank=True)

We have a lot of CharFields. No indexes.

We will be testing…

Step by step guide to writing Tetris in Python with PyGame

In this tutorial, we will write a simple Tetris using the PyGame library in Python. The algorithms inside are pretty simple but can be a little challenging for the beginners. We will not concentrate on PyGame mechanics too much, but rather focus on the game logic. If you are too lazy to read all the stuff, you may simply copy and paste the code in the end.

Tetris Game


  1. Python3. This may be downloaded from the official website.
  2. PyGame. Go to your command prompt or terminal, depending on the OS you…

A quick tip: How to reuse the Django built-in authentication forms

Django default Login View

Do you need to authenticate your users but don’t want to write HTML with CSS, add views for that, and add that view to the urls.py?

I know this feeling, and I am here to help you!

Most probably, you already have this path in your url patterns:

path('admin/', admin.site.urls),

And now, just add this to any of your views:

def index(request):
if request.user.is_anonymous:
return redirect("/admin/login/?next=/")

So, if the user is not authenticated, he/she will be redirected to the default login view of the Django system, and then…

Depth-First Search Tutorial. Intro to Recursive algorithms.

One of the ways to find a path is a recursive algorithm called “Depth-First Search”. If you thought that recursion is needed only for finding a factorial, you will be surprised.

Since we animate our algorithm, we will not go through all combinations and find the shortest path. We will find at least one path and will be happy with it. But sure you may go ahead and find all possible combinations, but you better do it in a normal graph, not a maze.

When do we need it?

Good question, thanks for asking.

It’s not a good idea to use it for finding a…

Do not hard code your passwords!

You know that it is bad to put your passwords in code. You git push it. Python code isn’t even compiled, so everyone can see it. And it is not convenient when you have different database connections on your machine and on the server.

Solution: Use Environment Variables

In this article, I will show you how to keep these variables in different Operating Systems and how to read them in Python.

When you publish your masterpiece to the Cloud, you set up a PostgreSQL server, and then the hell starts. Namely, you need to put your connection settings and the…

How to use cache_page in Django

There are many articles that explain how Caching works in Django. Most of them are complicated, so I decided to simplify everything for you.

Why Cache?

You may have some pages in your application that do not change so often. Your application still has to call your function and render an HTML.

It’s even worse if that is some statistics that should be computed and has access to your database. For example, it may be the number of views of a video on YouTube. Or the number of likes.

To calculate the number of views of a video, the server needs to…

IT Crowd

Most of these jokes have been found in Russian. Since I have not found the English version on the Internet, I decided to translate them for you. I truly hope you will enjoy this article!

0. Do you follow the Stack Overflow Driven Development (SODD) approach?

1. Have you ever been charged for storing your data in global variables?

2. What is the result of the following command?

git push me and then just touch me till I can get my satisfaction, satisfaction

3. Have you ever done .Net for money?

4. You have stated in your CV that you…

A quick intro to decorators in Python

You have seen and used decorators many times. But it was always magic for you.

It is time to finally understand decorators in Python.

Why use decorators?

Usually, this is an easy way to modify a lot of functions.

For example, you want to make sure that only authorized users are accessing this function.

Or you want to avoid printing something to the console. But only for some functions. And you want to quickly turn this feature on and off.

Or you want to do some preprocessing to your parameters first.

The good thing is that…

Perceived Performance

You are tired of improving the performance of your app? All your images are optimized, all your font imports are removed, you use lazy loading, your server at Digital Ocean or AWS is already expensive?

No worries, just make your app feel faster.

And here is how.

Airport Baggage Optimization

People hate waiting.

After a long flight, you have to wait for your baggage. And every minute you wait you get more tired and angrier.

Timur Bakibayev

Professor, Ph.D. in CS, Almaty Management University

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store