Two-factor (2FA) or multi-factor authentication (MFA) is an additional security layer for your business — helping to address the vulnerabilities of a standard password-only approach.
TOTP stands for Time-based One-Time Password. It’s a fairly simple algorithm that involves combining a shared secret key with the current time to generate a verification token that’s only valid for a short amount of time. Fully defined in RFC 6238, our implementation will use a specific subset of the definition supported by Google Authenticator. TOTP depends on your server and whatever client devices your visitors use have properly synchronized clocks. …
WebSockets is a technology that allows for opening an interactive communications session between a user’s browser and a server. With this technology, a user can send messages to a server and receive event-driven responses without requiring long-polling, i.e. without having to constantly check the server for a reply. Think about when you are replying to an email in Gmail, and at the bottom of your screen you see an alert pop up saying “1 unread message from [insert some email address here]” coming from the person you were just responding to. …
What is Celery Beat? It combines Celery, a well-known task delegation tool, with a nifty scheduler called Beat. It can help you manage even the most tedious of tasks.
As we know the work of software developers is filled with generating periodic reports, handling vast imports or exports, backups, frequent API requests, or simply sending batches of emails. Wouldn’t it be a developer’s paradise to have all these tasks automated and perfectly scheduled? It would — luckily, with the help of Celery Beat.
Automation in Django is a developer’s dream. Tedious work such as creating database backup, reporting annual KPI, or even blasting email could be made a breeze. Through Celery — a well-known software in Python for delegating task — such action has been made possible.
Celery is a task queue based on distributed message passing. It is used to handle long running asynchronous tasks. It allows us to do things in a distributed way (i.e run things remotely so that our server doesn’t take too much time loading that process). Celery is perfectly suited for tasks which will take some time…
PostgreSQL is an advanced object-relational database management system
that supports an extended subset of the SQL standard, including
transactions, foreign keys, subqueries, triggers, user-defined types
and functions. It is also one of the most used databases in the industry for production and deployment.
Here we’ll install PostgreSQL 9.5.11 on Ubuntu 16.04 system.
Ubuntu’s default repositories contain Postgres packages, so we can install these easily using the
sudo apt-get updatesudo apt-get install postgresql postgresql-contrib
It’ll create postgres service
➜ ~ sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)…
Redis is a versatile tool that can be very useful in our Python/Django projects.Through this blog my goal is to explain how Redis can be used in multiple different scenarios, with real examples of building counters, leaderboards, analytics’ tools, and a recommendation engine. The blog showcases practical examples of how to use Redis with Python / Django and a final demo to interact with the public. It also shows the best practices when using it with Django.
Redis is an in-memory data structure store that can be used as a caching engine. Since it keeps data in RAM, Redis can…
In many cases when there is a modification in a model’s instance we need execute some action. Django provides us an elegant way to handle these situations. The signals are utilities that allow us to associate events with actions. We can develop a function that will run when a signal calls it.
The most common example of using Django signals is when we want to create a user profile as soon as the user creates his account which can be done by creating a signals.py file in your app directory with following code :~
from django.db.models.signals import post_save
from django.contrib.auth.models import…
Both the threading and multiprocessing modules in python aim to do the same thing and that is to do a number of things at the same time, however the way that threading module goes about it and the multiprocessing module goes about it is very different.
Before going deep into this topic it’s best to know what is a thread and what is a process :~
Django ships with a built-in User model for authentication, however the official Django documentation highly recommends using a custom user model for new projects. The reason is if you want to make any changes to the User model down the road–for example adding a date of birth field–using a custom user model from the beginning makes this quite easy. But if you do not, updating the default User model in an existing Django project is very, very challenging.
This post will detail how to create a custom user with
From all the time i have been coding,i learned one thing and that is the code/program we write first is not always the best or the optimal solution. Django QuerySets are no exception to this .
If a web request is stretching into seconds, 99% of the time the database isn’t being used correctly.
The Django ORM can be both a blessing and a curse. It makes it easier and more intuitive to make queries and work with complex data sets. …