How to Use Email as Username for Django Authentication

0: Intro The aim of this post will be explaining how to create a custom User Model in Django. So we can use that email address as the primary ‘user identifier’ instead of a username for authentication. Default Django app will give you a User Model that has a mandatory username field, and an ‘optional’ email field. However if you’re starting a new project, Django highly recommends you to set up a custom User Model.

How to Create SECRET_KEY for Django Settings

When you start a django project, django-admin startproject automatically adds a randomly-generated SECRET_KEY to each new project. However if you want to change it, or add a seperate one to each of your environment, e.g: one for ‘production’, one for ‘staging’, one for ‘production’ etc, how do you gerenerate a new ones? There would be another case: you cloned a project from a remote repo and want to change the default SECRET_KEY.

How to Set Permanently $PATH on Linux/Unix

You’re trying to add a directory to your $PATH so it will always be in your linux $PATH and accessible anywhere. You can add your ‘path’ to $PATH with below command: $ export PATH=$PATH:/path/to/dir However each time you exit the terminal or start a new terminal instance, or reboot the system this path is lost and you need to run the export command again. To set it permanently follow one of the two below:

How to Use UUID as a Primary ID in Django Models

Intro In Django whenever we create any new model, there is an ID-or PK, model field attached to it. The ID field’s data type is integer by default. To make this integer id field UUID, we can use UUIDField model field, which was added in Django 1.8. UUID A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. They are commonly represented as 32 hexadecimal characters separated by four hyphens.

How to Install Python 3.8 on Ubuntu

This brief tutorial shows how to install and configure Python 3.8 on Ubuntu. There are 2 methods to install python on Ubuntu. I prefer first method and strongly recommend that but it depends on developer’s taste. Method 1: Install It From Source Code I prefer this method since I’d rather always go to source, whether it is documentation for an API or installing something. Out of the box default python version for Ubuntu 18.