My Blog

My WordPress Blog

My Blog

My WordPress Blog

Day: September 24, 2024

 How you can include and inherit files in your application?

Using the extends tag in Templates, we can inherit our files in Django, The extends tag is used to inherit these templates. The syntax for inheriting these templates is given as: This syntax helps us to add all the elements of an HTML file into another without copy-pasting the entire code. Django templates not only […]

What is Media Root?

Media root is used to upload user-generated content. We can serve user-uploaded media files locally, using the MEDIA_ROOT and MEDIA_URL settings. User-upload these files are referred to as Media or Media Files in Django. The first step is to include the code below in the settings.py file. MEDIA_ROOT = os.path.join(BASE_DIR, ‘media’)MEDIA_URL = ‘/media/’ MEDIA_ROOT: It is for the server […]

 Explain the use of Middlewares in Django.

Middleware is a lightweight plugin in Django that is used to keep the application secure during request and response processing. The application’s middleware is utilized to complete a task. Security, session, CSRF protection, and authentication are responsible for doing some specific functions. The application’s security is maintained by the usage of the middleware component, AuthenticationMiddleware which is […]

What do you mean by the csrf_token?

Cross-Site Request Forgery (CSRF) is one of the most serious vulnerabilities, and it can be used to do everything from changing a user’s information without their knowledge to obtaining full control of their account. To prevent malicious attacks, Django provides a per cent token per cent tag {% csrf_token %} that is implemented within the form. When […]

Scroll to top