PYTHON FOR WEB DEVELOPMENT
Authors: Patkar Uday , Singh Priyanshu , Panse Harshit , Bhavsar Shubham , Pandey Chandramani 
Published: April 2022

With evolution of web, several competitive languages such as Java, PHP, Python, Ruby are catching the attention of the developers. Recently Python has emerged as a popular and the preferred web programming language, because of its simplicity to code and ease of learning. Being a flexible language, it offers fast development of web-based applications. It offers development using CGI and WSGI. Web development in Python is aided by the powerful frameworks such as Django, web2py, Pyramid, and Flask that Python supports. Thus, Python promises to emerge as one of the preferred choice language for web applications. Web is a rapidly growing repository of resources. Internet is used as a medium for accessing these resources. Web architecture mainly comprises of two entities, namely client and server. Web client is an application (browser) on host machine that urges these resources, and web server is a machine on web that is responsible for fulfilling the request issued by client. Hypertext Transfer Protocol (HTTP) is the most popular protocol used by client and server for web communication. In a static web, browser issues HTTP request to the HTTP server, which searches for the requisite resource in its database and returns it as an HTTP response. To avoid any compatibility issues, every request issued by browser is in form of a URL (Uniform Resource Locator). The URL protocol defines the rules for communication between client and server. It comprise of host name (IP address) which helps in identifying the server system on the web, port number which determines the service (for example, FTP, email service) on the server that should respond to request, and the access path of the resource (web page) on server. The web where responses are already stored in server database in form of static web pages is termed static web. However, response returned by server to the client may be generated on the fly depending upon the request of the client. Web applications offer several benefits over traditional applications that are required to be installed at each host computer that wishes to use them. Web applications do not incur publishing and distribution costs as opposed to traditional applications where the software (applications) were published using CD’s and distributed. They need not be installed at each client host; rather they are placed at a central server and accessed by large number of clients. Since a web application is managed centrally, application updates and data backups can be performed easily. The web applications are easily accessible irrespective of the boundaries of space and time. Since, they are accessed through browser, the platform accessing them is not an issue, and thus they provide cross-platform compatibility. Inspite of above- mentioned advantages, web applications have a few limitations. Internet connectivity and server availability is required for accessing web application through browser. However, accessing them through Internet my take more time as compared to applications installed on host systems. Also, web applications require compatible web browsers. Since they are deployed on web, they are vulnerable to several Internet attacks. Web programming using CGI and WSGI requires building web applications from the scratch by using Python standard libraries. Python provides with web frameworks in the form of packages/ modules that simplify the task of writing application programs. These frameworks lighten tedious job of developers. They support server and client side programming by providing support for several activities such as request interpretation (getting form parameters, handling cookies and sessions), response generation (generating data in HTML or other format such as pdf, excel), and storing data. The web frameworks are further categorized as full- stack and non-full-stack frameworks. Full-stack frameworks provide components for every phase of programming in contrast to non-full-stack frameworks. All the frameworks include templates and data persistence as key ingredients for constructing web. Templates are used to avoid complex code that results when HTML and Python code is mixed in a single file. Templates are HTML files with placeholder for the data depending upon user input. Data persistence deals with storing and retrieving data and maintaining consistency. The data can be stored and maintained using plain text files, relational database engines such as MYSQL, Oracle, or some object-oriented databases. The web framework providing support for WSGI should be preferred. This makes deploying an application easier.