What is the role of Cookie in Django?

A cookie is a small piece of information which is stored in the client browser. It is used to store user’s data in a file permanently (or for the specified time). Cookie has its expiry date and time and removes automatically when gets expire. Django provides built-in methods to set and fetch cookie. The set_cookie() … Read more

What is Django Session?

A session is a mechanism to store information on the server side during the interaction with the web application. By default, session stores in the database and also allows file-based and cache based sessions. In Django, a session is a mechanism used to store and retrieve arbitrary data pertaining to a particular user’s interaction with … Read more

What is Django Exception?

An exception is an abnormal event that leads to program failure. To deal with this situation, Django uses its exception classes and supports all core Python exceptions as well. Django core exceptions classes are defined in django.core.exceptions module. In Django, an exception is an error that occurs during the execution of a program. Django, like … Read more

How to handle URLs in Django?

To handle URL, django.urls module is used by the Django framework. Let’s open the file urls.py of the project and see the what it looks like: // urls.py from django.contrib import admin from django.urls import path urlpatterns = [ path(‘admin/’, admin.site.urls), ] See, Django already has mentioned a URL here for the admin. The path … Read more

What are the two important parameters in signals?

Two important parameters in signals are: Receiver: It specifies the callback function which connected to the signal. Sender: It specifies a particular sender from where a signal is received. In Django, signals are a way for decoupled applications to get notified when certain actions occur elsewhere in the application. The two important parameters in signals … Read more