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
ORM stands for Object Relational Mapper. The main goal of ORM is to send data between a database and models in an application. It maps a relation between the database and a model. So, ORM maps object attributes to fields of a table. The main advantage of using ORM is that it makes the entire development process fast and error-free. Essentially, it eliminates the need to write SQL code. Suppose there is a python object student with certain attributes as you can see below. Model student: Id Rollno Name ... Read More
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
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
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
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
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
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
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
A final variable can be explicitly initialized only once. A reference variable declared final can never be reassigned to refer to a different object. However, the data within the object can be changed. So, the state of the object can be changed but not the reference. With variables, the final modifier often is used with static to make the constant a class variable. Therefore, once we declare a final variable it is mandatory to initialize the final variable at the time of declaration or using constructor. If not, a compile time error may occur saying “The blank final field num ... Read More