Django web development tutorials
Build secure Django apps with practical examples.
Learn Django concepts through focused guides on models, slugs, authentication cookies, JWT handling, and safer Python web application patterns.
Django library
4
tutorials
2
topic groups
Practical Django guides
Django tutorials
Start with the model layer, then move into routing-friendly slugs and authentication patterns used in real Django projects.
JWT token as HttpOnly cookie in Django
It is always recommended to store tokens for authentication as HttpOnly cookie instead of storing them in localStorage as a normal cookie which will not be accessible by JavaScript from the frontend. By using an HttpOnly we can avoid XSS attacks on our website. In this tutorial, we will learn how to store a JWT token as a HttpOnly cookie in the browser in Django.
Read tutorial
HttpOnly cookie in Django
For authentication in a Single page application, it is a common approach to use token-based authentication where a token is sent to the backend for protected routes. Instead of storing the token in localStorage or cookie, we should use the HttpOnly cookie. By using an HttpOnly we can avoid XSS attacks on our website. In this tutorial, we will learn how to store HttpOnly cookie to the browser in Django.
Read tutorial
Django slug tutorial: adding slug field in a django model
In this tutorial, we are going to learn what is a slug and how to add slug or SlugField in a Django model. Slug is just a part of URL which uniquely identifies a page or blog and explains the content of the page.
Read tutorial
Custom User Model in Django
In this tutorial, we will be learning how to create a custom user model or extending user model to add some fields and to grab more control over user model.
Read tutorial