Programming Articles - Page 603 of 3363

How to protect against cross-site scripting (XSS) in Django?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:28:21

593 Views

Web applications that fail to appropriately escape user-submitted text before rendering it into HTML are vulnerable to cross-site scripting (XSS). An attacker can use this to inject arbitrary HTML into your Web page, commonly in the form of a element. XSS attacks are frequently used by attackers to steal cookie and session information, as well as to fool users into providing personal information to the wrong person. Phishing is another term for this. We will look at a common case because this type of attack can take many different shapes and has nearly unlimited variations. Let us consider simple ... Read More

What is CSRF token in Django?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:31:35

13K+ Views

CSRF stands for Cross Site Request Forgery, and it is said to occurs when a malicious Web site deceives users into unwillingly and unknowingly loading a URL from a site where they've previously been authenticated, thus exploiting their status and also putting the data at risk. To understand what the CSRF attack exactly is, let us look into an example. Assume you're logged into csrfexample.com's webmail account. The Log Out button on this webmail site leads to the URL csrfexample.com/logout. That is, all you have to do to log out is visit the page csrfexample.com/logout. A rogue site can force ... Read More

How to make Django admin more secure?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:20:02

518 Views

Django is a web framework that is popular for its ease of usage. Django like many other web frameworks comes equipped with a lot of features and functionalities that can be used without much code to write. Django-admin is one of those features. The automatic admin interface is one of Django's most powerful features. It reads metadata from your models to create a model-centric interface for trusted users to manage content on your site. The admin's recommended use is limited to the internal management tool of an organization. It is not meant to be the foundation for your complete front ... Read More

How to add security to your Django website?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:07:27

623 Views

Communication through the web happens through a HTTP connection and more often than not you never know who is on the other end. It may be one of your users, but it could also be a malicious hacker searching for an opportunity. Any data from the browser, regardless of its source, should be processed with caution and checked for threats. This includes data from Web forms as well as information from HTTP headers, cookies, and other request metadata. As Web developers, we have a duty to do what we can to combat these forces of darkness. Every Web developer needs ... Read More

How to add validation to your Django project?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:04:13

545 Views

Validation is the process through which the computer automatically checks to ensure that the data entered is sensible and reasonable. It does not provide if the data entered is accurate or not. Many of us are familiar with email or phone validation that is usually a part of most websites. When we enter the email address in the wrong format or if the phone number entered does not contain 10 digits, a warning is usually displayed to enter the output in the accepted format. This is validation. Most developers add validation to their projects to ensure that the data they ... Read More

How to upgrade django to a newer version in anaconda?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:02:38

631 Views

Anaconda is very popular framework used for python development. It enables users to develop web applications, desktop application, data analysis programs, machine learning applications and more. Another great feature of anaconda is that it enables users to create virtual environments, so installing a package or library only in that environment saves a lot of space and time. Django is widely used for python web development due to its ability to ease server-side scripting. To install Django in your anaconda environment, you can use the following command. conda install django To create a virtual environment and install Django inside it, ... Read More

What are projects and apps in Django?

Gayatri Jandhyala
Updated on 02-Sep-2022 14:01:22

710 Views

Django is a popular web framework used for the development of websites. Django follows the MVT (Model-View-Template) architecture. Here, Model is responsible for the data and logical structure of your project, View contains the business logic and Template is responsible for rendering the HTML files. The hierarchy of project in Django consists of projects and apps. Project refers to the entire web application. Apps are the functionalities that are part of the web application. All of them work individually and can be reused. Creation of a project A project is essentially a collection of settings for a specific instance of ... Read More

How to install Django in Anaconda?

Gayatri Jandhyala
Updated on 02-Sep-2022 13:59:28

11K+ Views

In this section, we are going to look at how to install anaconda in your computer. And then we will move into how to install Django in this anaconda environment. Anaconda is a popular run time environment for python programs. The anaconda distribution provides many environments such as Spyder which is an IDLE to run python programs, Jupyter, which is a web application that lets users to perform visualizations and more, and anaconda also includes a PowerShell Prompt that is a command prompt of sorts that lets users to run programs on the command line. Anaconda Installation The steps to ... Read More

How to Find the Perimeter of a Circle in Golang?

Aman Sharma
Updated on 02-Sep-2022 13:08:16

330 Views

In this tutorial, we are going to see the Golang program to find the perimeter of a Circle. Perimeter is the total length of the boundary of any closed figure. Formula Perimeter of Circle - 2 * 22 / 7 * r r - radius of a Circle For example, the radius of a Circle is 10 cm so the perimeter of a Circle is − perimeter = 2 * 22 / 7 * 10 = 62.8571428 Finding the perimeter of a circle within the function Algorithm Step 1 − Declaring the variables for ... Read More

How To Find The Area of a Trapezium in Golang?

Aman Sharma
Updated on 02-Sep-2022 13:06:14

275 Views

In this tutorial, we are going to see the Golang program to find the Area of a Trapezium. The area is the total space covered by any closed figure. Formula Area of Trapezium - ½ * (b1 + b2) * h b1 - length of one parallel side of a Trapezium b2 - length of another parallel side of a Trapezium h - the distance between the parallel sides of a Trapezium. For example, the length of one parallel side of a Trapezium is 10 cm and the other parallel side is 8 cm, and the distance between ... Read More

Advertisements