Python As A Tool For Web Server Application Development -Books Download

Python as a Tool for Web Server Application Development
15 Nov 2019 | 40 views | 0 downloads | 7 Pages | 872.29 KB

Share Pdf : Python As A Tool For Web Server Application Development

Download and Preview : Python As A Tool For Web Server Application Development

Report CopyRight/DMCA Form For : Python As A Tool For Web Server Application Development


JIMS 8i International Journal of Information Communication and Computing Technology IJICCT . which is a web browser which renders the static dynamic HTTPServer available in it Within the same module basic. content returned by server middle tier is the server which handler termed BASEHTTPRequestHandler is available but. uses dynamic web languages and tools such as Python PHP it offers only the functionality to take the client input . Ruby ASP NET for web application development which SimpleHTTPRequestHandler found in SimpleHTTPServer. handles the user specific request and returns the data Third module offers additional GET functionality 7 GET method. tier is the database which provides storage means is used for fetching the requisite document from the. database Parameters of GET method are part of URL . Similar to GET method is the POST method that is used for. updating data POST parameters are included in the body of. HTTP Request the document 8 CGIHTTPRequestHandler found in. Data CGIHTTPServer module takes SimpleHTTPRequestHandler. HTTP Reply and provides additional functionality of POST method 7 . CLIENT SERVER DATABASE, When a web server receives a client request via GET or. POST method it invokes the web application and returns. Figure 1 Web Application Architecture the dynamically generated HTML page to the client This. process takes place through CGI CGI is the Common. Web Development involves programming both client and Gateway Interface which act as an interface between server. server side Programming at server side is associated with and the application program 7 9 10 Figure 2 presents. writing web applications providing web site web pages etc overview of working of CGI 7 CGI application depicted in. Programming at client side is associated with developing Figure may use database for data storage and retrieval. tools or interfaces for accessing these web applications sites purpose . or pages Server side programming languages include. Python PHP Ruby ASP NET Java CGI C Perl Client, side programming languages include HTML CSS and HTTP Request. Completed Invoke,Javascript 6 Form CGI, Application. The rest of the paper is divided into three sections Section 2. discusses web development using Python through CGI HTTP Reply CGI. WSGI and Python frameworks Section 3 compares Python CLIENT CGI application application. with popular web programming languages PHP and Ruby reply CGI. Section 4 concludes the paper by giving summary SERVER. 2 WEB SERVER APPLICATION DEVELOPMENT Figure 2 Working of CGI. A CGI and WSGI Web Server Application, Figure 3 depicts an HTML form Form html that prompts. Development using Python Standard Library the user for the input Python CGI script. CGIFormResponse py is invoked after submitting the. A 1 CGI form It should be noted that a server listening to user. requests must be running all the time For achieving this you. In a static web documents static web pages over the web may run the server for Python2 x versions by executing. can be returned easily to the client on its request However CGIHTTPServer py listed in Lib directory of Python2x. dynamic web involves generating the reply on the fly based folder from command prompt For example . upon the user input such as input in a form Since server. has the ability to only take the user request and to return the C Python27 Lib CGIHTTPServer py. response it cannot handle user specific data and generate the Serving HTTP on 0 0 0 0 port 8000 . response So it uses web applications for dynamically. generating response It may be noted that above statement will run HTTP server. on port number 8000 However you may also run the, Creation of a web server needs a base server and a handler CGIHTTPServer on a specific port The most commonly.
Base server is responsible for carrying out HTTP used server is Apache As specified CGIHTTPServer. communication between client and server whereas handler module includes a class CGIHTTPRequestHandler. is responsible for processing the request and returning the extending handler class of SimpleHTTPServer module This. result in the form of a web page or document 7 The module handles the user request by forking a process and. module BaseHTTPServer has the common base server class providing implementation for GET and POST method . Copyright IJICCT Vol II Issue I Jan Jun2014 ISSN 2347 7202 78. Python as a Tool for Web Server Application Development. HTML form that is presented to user for providing input CGI provides support for use of cookies using which server. must be placed within the same folder where server is saves data on client side It also supports processing of. running Lib Within that folder another folder is created multiple inputs provided for a field for example using. with name cgi bin and py files are placed there It may be checkboxes 7 Web programming using CGI is not. noted from Form html file in Figure 3 that after submitting preferred since for each client request server forks a process. the form CGIFormResponse py is invoked for processing of CGI python program This will lead to wastage of time. the input as also illustrated through URL in the browser since python interpreter will be initiated for each request . CGI python script imports cgi module which contains For a large number of requests this may bring the server to. FieldStorage class 7 11 This class is needed for reading halt The problem associated with CGI can be overcome by. the data received from web client through web server When using two modes embedded or daemon 4 Embedded. python script is invoked an instance of this class is created mode eliminates the need to fork the process for every client. This class instance comprise of key value pairs that form a request by integrating the interpreter within the server for. dictionary Keys are the names of input fields on the form example mod wsgi and mod python In daemon mode . and values refer to the input provided by user for those web server communicates with long running background. fields processes termed daemons for processing request for. example mod wsgi and mod fastcgi This saves the time. involved in spawning the process for each request . Web Server Gateway Interface WSGI is a standard that. facilitate interaction between the server and the application. by acting as an interface 4 It is currently the most. preferred interface for python web programming Figure 4. presents overview of working of WSGI , HTTP Request WSGI App. Application, HTTP Reply WSGI, CLIENT application, Figure 4 Working of WSGI. A WSGI application is an invokable application that takes. two parameters 12 First parameter is a dictionary type that. comprises of environment variables such as HTTP HOST . SERVER PROTOCOL and their values 7 Second, parameter is a callable function that must be executed for. initiating response to the client The response prepared. contains response code indicating status of response which. comprises of status code and reason phrase 200 OK 302. Found 403 Forbidden 500 Server Error HTTP response. may also contain HTTP headers such as Date date and time. of message initiation Server server software and its. version Content Type type of content in response body . Figure 3 Web, and Content Length size of content in response body 13 . Application based on CGI, The WSGI application is called from the server side and two.
required arguments are passed to it Result returned by the. Copyright IJICCT Vol II Issue I Jan Jun2014 ISSN 2347 7202 79. JIMS8i International Journal of Information Communication and Computing Technology IJICCT . application is sent back to the client It may be noticed that B Web Server Application Development using Python. WSGI acts as an interface between the application and the Web Frameworks. server The program at server side that invokes WSGI. application can either be written by the developer or he may Web programming using CGI and WSGI requires building. use the python provided reference server available in library web applications from the scratch by using Python standard. wsgiref simple server WSGIServer 7 Thus using WSGI libraries Python provides with web frameworks 15 4 in. one can implement both sides of the interface server as well the form of packages modules that simplify the task of. as application writing application programs These frameworks lighten. tedious job of developers They support server and client. Figure 5 shows WSGI py where method make server of side programming by providing support for several activities. module simple server creates a server listening on host such as request interpretation getting form parameters . localhost at port 8000 responsible for calling function handling cookies and sessions response generation. wsgiApp This server is made to run in an infinite loop using generating data in HTML or other format such as pdf . method serve forever Function wsgiApp initiates HTTP excel and storing data The web frameworks are further. response to the client by setting status to 200 OK and categorized as full stack and non full stack frameworks 15 . header Content type to text html Header Content type Full stack frameworks provide components for every phase. helps the client in determining how to interpret the response of programming in contrast to non full stack frameworks . of server After initiating the response function wsgiApp. returns the content to the client All the frameworks include templates and data persistence as. key ingredients for constructing web 4 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 4 This makes deploying an application easier . In the following paragraphs we briefly describe some. popular web frameworks , Full Stack Frameworks, a Django. Being a full stack framework Django supports quick. web application development requiring lesser core to be. done It is popularly known as the web framework for. perfectionists with deadlines 16 It provides ease in. creating web applications with fewer lines of code and. is scalable 17 It includes a built in server that can be. used for developing and testing the applications The. framework comes with comprehensive well written, Figure 5 Web Application based on WSGI documentation Features of this framework include. templates support for relational database model, Databases include MySQL SQLite Oracle and. Sometimes the request given to WSGI application may PostgreSQL comprehensive security etc It is well . require some pre processing such as modifying the request suited for database driven applications The framework. parameters or redirecting that request Also result returned is based on the principle of reusability of code and non . by WSGI application may need further post processing such redundancy of information Examples of applications. as formatting the results Pre processing and post processing built using this framework include Pinterest Instagram . involved with WSGI application can be achieved through Mozilla The Onion . additional wrapping functionality in form of layers termed as. middleware 4 14 b TurboGears, Copyright IJICCT Vol II Issue I Jan Jun2014 ISSN 2347 7202 80. Python as a Tool for Web Server Application Development. TurboGears framework combines SQLAlchemy Built in server of CherryPy offers a multi threaded. Pylons Genshi Repoze and Tosca Widgets This environment 27 Websites build using this framework. framework includes 1 x and 2 x series where the 2 x include Netflix Urbanility CherryMusic Learnit. series comprises of all the above specified components Training 26 . However 1 x series consists of SQLAlchemy Genshi . CherryPy and MonchKit It supports both client and c Flask. server side web programming It offers designer friendly Flask framework is based on Werkzeug and Jinja 2 and. template system 18 It has found its use mainly for good intensions 28 This framework has no. offering solutions for industrial problems with high dependencies apart from Python Standard Library Flask. complexity The framework supports several databases does not include components that need third party. among which SQLAlchemy is considered to be most support such as validating form or providing a means of. powerful database management system 19 This communication between the application and the. framework is used by SourceForge Fedora Community database However such features may be added using. TavolaClandestina Glossom ShowMeDo etc extensions Services offered by this framework include. built in HTTP server support for unit testing and. c web2py RESTful web service 29 Applications built using this. The framework supports fast development of scalable framework are minitwit flaskr flask pocoo org etc . secure and portable web applications 20 21 It does. not require any installation and can be run via USB d Pyramid. drive This framework has no dependencies The Pyramid is a fast reliable simple and mini web. web2py application itself acts as an Integrated development framework 30 This framework is. Development Environment offering all the capabilities compatible with Python 3 Being a fully documented. such as creating application debugging and testing It framework developers find an easy start for developing. comes with a ticketing system that helps in tracking the web applications It supports several databases such as. source of error occurred by assigning a ticket to the user SQLalchemy Zope Object Database and CouchDB . 22 It supports several databases such as MySQL Websites built using this framework include. PostgreSQL SQLite Oracle Examples of applications newcars com SurveyMonkey PwnedList . built using this framework include Movuca Instant. Press and LinkFindr Other non full stack frameworks include Albatross . Aquarium AppWsgi BlueBream Bobo circuits web , Other full stack frameworks include CubicWeb Django Divmod Nevow G WAN Gunstar PyWebLib Quixote .
Hotsauce Giotto Grok Pylons Wheezy Web Gizmo Spiked Spinne weblaver WebStack WSGIServlets 15 . Glashammer Karrigell Kiss py Lino Nigare Porcupine . Pylatte QP SkunkWeb Spyce Tipfy Tornado Watson Specifications of popular web frameworks are provided in. Webapp2 WebBot WebCore Web py Webware Table 1 31 All the above mentioned web frameworks are. Werkzeung and WHIFF 15 based on MVC Model View Controller 32 architecture. for web applications It comprises of three components . model view and controller Model comprises of the data. Non Full Stack Frameworks and its logic i e requisite action to be performed View. refers to the interface presented to the user Controller. a Bottle controls both model and view by calling a model depending. Bottle is an easy and simple framework used for quickly upon user input and instructing model to update the data or. building small web applications This framework has no change the state of data Based on the result of invoked. dependencies apart from Python Standard Library model controller instructs the view to change the presented. 23 24 It has built in web server that may be used for layout For example changing the view based on user input. testing purpose This framework is compatible with such as page up and page down Excluding Bottle and. Python 3 23 Application built using this framework Flask all frameworks mentioned above provide Object. includes Pasttle Relational Mapping ORM 33 that is responsible for. mapping objects containing information to the relational. b CherryPy databases where classes and objects are mapped to the. CheeryPy is an object oriented HTTP web framework relations and their tuples So ORM maps modifications and. 25 This framework was developed with the purpose insertions for an object set to the relational database. of enabling user to develop the application as a regular operations . python program with lesser lines of code It is, considered to be the one of minimal frameworks. provided for Python 25 It lacks templating system . Copyright IJICCT Vol II Issue I Jan Jun2014 ISSN 2347 7202 81. JIMS8i International Journal of Information Communication and Computing Technology IJICCT . Latest various appropriate measures 36 for reducing. Framework Stable License MVC ORM Python vulnerabilities PHP based applications are not among the. Version best at error handling Also PHP based applications are. embedded in the server It is used by big firms such as. Django 14 May BSD Yes Yes, 2 7 Facebook Yahoo Wikipedia and Google . 2 4 Python was developed by Guido van Rossum in 1991 . TurboGears 8 March MIT Yes Yes Python being a simple programming language naturally. 2014 lends itself to being a preferred choice for beginners It. 16 2 4 offers fast development of web based applications that have. web2py LGPL Yes Yes comparatively lesser lines of code 9 It is a modular and. March above, 2014 object oriented programming language It is a flexible. 0 12 7 language because of the large availability of third party. Bottle 29 April MIT Yes No support It follows strict indentation for defining the block of. code It used by big firms such as Google pinterest . 2 3 Youtube and Instagram , CherryPy 17 April BSD Yes Yes. 0 10 1 Ruby was developed by Yukihiro Matsumoto in 1995 It is. Flask 14 June BSD Yes No, above also simple to learn readable maintainable and a pure.
object oriented language One of the most important web. 2 6 frameworks of Ruby is Ruby on Rails which uses CGI as the. Pyramid 31 May BSD Yes Yes, above gateway and has a built in web server 37 It can be used for. scalable applications where security is one of the main. Table 1 Comparison of Web Frameworks concerns It is used by big firms such as Github Scribd . Twitter and Groupon , Almost all the seven web frameworks specified above. support features such as built in server internationalization Table 2 compares these web programming languages on. helps in adding languages and their translation several criteria 38 39 40 . authentication and authorization of end user caching . debugging error logging help in keeping track of errors. Comparison, occurred along with their description and time routing the Python PHP Ruby. request to another URL and managing sessions Criterion. Purpose General Web General, Popular among developers. according to TIOBE Feb 8th rank 7th rank 14th rank. 3 WEB DEVELOPMENT LANGUAGES COMPARED 2014 index, Ease of Learning Easiest Easy Difficult.
There are several web development languages available in development time Faster Fast Fastest. Execution Speed All are equally good, market that are used by the developers These languages can. Exception Handling Best Worse Best, be categorized as server side and client side scripting. Security Best Worse Best, languages Server side technologies include CGI Java . Readable and Maintainable Best Worse Worse, ASP NET Ruby Python and PHP whereas client side Robustness Best Worse Better. technologies include HTML CSS Javascript and Java, Applet This section will discuss three most popular web Table 2 Comparison of Web Development Languages.
development languages Python PHP and Ruby that are the. preferred choices for a developer All these languages are. dynamic in nature and are open source 34 , 4 CONCLUSION. PHP 35 was developed by Rasmus Lerdforf in 1994 It. Inspite of availability of so many web development. stands for Hypertext Preprocessor It is based on MVC languages Python is evolving as the popular language. architecture There are several content management systems among developers Web development in Python can be done. written using PHP that helps a non programmer to build up using CGI or WSGI that uses python standard libraries . an application Examples include Joomla and Wordpress However such development requires building web. PHP applications can easily be deployed It offers great applications from scratch So Python provides web. support for extensions and databases Further it is platform development frameworks such as Django Pyramid web2py. independent It is not preferred if security is the prime that helps in web application development This helps the. concern However one may still incorporate security using. Copyright IJICCT Vol II Issue I Jan Jun2014 ISSN 2347 7202 82. Python as a Tool for Web Server Application Development. developer in doing the minimal requisite core needed for 22 Di Pierro Massimo web2py Manual 3rd ed . building the applications Lulu com , 23 Bottle Python Web Framework . REFERENCES http bottlepy org docs dev index html , 24 Full Stack Python Bottle . http www fullstackpython com bottle html , 1 Berson Alex Client server architecture No 25 CherryPy http cherrypy org . IEEE 802 McGraw Hill 1992 26 Websites running atop CherryPy . 2 Shklar Leon and Richard Rosen Web application https cherrypy readthedocs org en 3 3 0 appendix . architecture Principles Protocols and Practices success html . Editura Wiley 2009 27 Hellegouarch Sylvain CherryPy Essentials Rapid. 3 Suh Woojong ed Web engineering principles Python Web Application Development Packt. and techniques IGI Global 2005 Publishing Ltd 2007 . 4 Kubica Marek How To Use Python in the web 28 Flask http flask pocoo org . https docs python org 2 howto webservers html 29 Grinberg Miguel Flask Web Development . 5 Grove Ralph F Web Based Application Developing Web Applications with Python . Development Jones Bartlett Publishers 2009 O Reilly Media Inc 2014 . 6 Pratt Terrence W Marvin V Zelkowitz and 30 Pyramid http pyramid readthedocs org . Tadepalli V Gopal Programming languages 31 Index of Packages https pypi python org pypi . design and implementation Englewood Cliffs 32 Deacon John Model view controller mvc . Prentice Hall 1984 architecture http www jdl co , 7 Chun Wesley J Core Python Applications uk briefings MVC pdf 2009 .
Programming Prentice Hall Press 2012 33 O Neil Elizabeth J Object relational mapping. 8 Huffman Steve and Bennett Sean Web 2008 hibernate and the entity data model edm . Development How to Build a Blog Proceedings of the 2008 ACM SIGMOD. https www udacity com course cs253 international conference on Management of data . 9 Watters Aaron James C Ahlstrom and Guido Van ACM 2008 . Rossum Internet programming with Python 34 Sebesta Robert W Programming the world wide. Henry Holt and Co Inc 1996 web Pearson Addison Wesley 2008 . 10 Ramu Chenna and Christina Gemuend cgimodel 35 Gerken Till and Tobias Ratschiller Web. CGI programming made easy with Python Linux Application Development with PHP New Riders. journal 2000 75es 2000 8 Publishing 2000 , 11 Web Python 36 Shiflett Chris Essential PHP security O Reilly. http webpython codepoint net cgi tutorial Media Inc 2006 . 12 PEP 333 Python Web Server Gateway Interface 37 Viswanathan Viswa Rapid web application. v1 0 https www python org dev peps pep 0333 development a Ruby on Rails tutorial Software . 13 Hypertext Transfer Protocol IEEE 25 6 2008 98 106 . http www w3 org Protocols HTTP 1 0 spec html 38 Purer Klaus PHP vs Python vs Ruby The web. 14 Gardner James The Web Server Gateway scripting language shootout 2009 . Interface WSGI The Definitive Guide to Pylons 39 Gaikwad H M Article on Code Wars PHP vs. 2009 369 388 Ruby vs Python languages, 15 Web Frameworks for Python 40 Hardy Will Comparing web development. https wiki python org moin WebFrameworks platforms through the eyes of professional. 16 Forcier Jeff Paul Bissex and Wesley developers Technical report Institut f r. Chun Python web development with Informatik Freie Universit t Berlin 2007 . Django Addison Wesley Professional 2008 , 17 Django https www djangoproject com . 18 TurboGears http turbogears org , 19 Ramm Mark Kevin Dangoor and Gigi. Sayfan Rapid Web Applications with, TurboGears Pearson Education 2006 .
20 Mulone Pablo Martin and Mariano, Reingart web2py Application Development. Cookbook Packt Publishing Ltd 2012 , 21 web2py http web2py com . Copyright IJICCT Vol II Issue I Jan Jun2014 ISSN 2347 7202 83.

Related Books

Fokker 50

Fokker 50

The Fokker 50 is a regional turboprop aircraft of which a total of 208 were built until 1997 by the Fokker Aircraft Company. It was the natural successor of the F-27 Friendship. Designed with a life of 90,000 landings, many Fokker 50s are currently in service with close to 30 operators worldwide in all types of operational environments.

Paracetamol-modified release - EMEA-H-A-31-1445 ...

Paracetamol modified release EMEA H A 31 1445

- paracetamol 665 mg modified-release tablet (Alvedon 665 mg MR of GSK Consumer Healthcare). GSK Consumer Healthcare also holds two MAs in Denmark for a 500mg and 1000mg paracetamol modified release tablet, however commerciali sation of both of these ceased in 2011. - paracetamol 500 mg prolonged release tablet (Actavis) .

An Android Studio SQLite Database Tutorial

An Android Studio SQLite Database Tutorial

An Android Studio SQLite Database Tutorial Previous Table of Contents Next An Android Studio TableLayout and TableRow Tutorial Understanding Android Content Providers in Android Studio Purchase the fully updated Android 6 Edition of this Android Studio Development Essentials publication in eBook ($9.99) or Print ($38.99) format

Hustler Taboo - mybooklibrary.Com

Hustler Taboo mybooklibrary Com

Hustler Taboo Free PDF eBook Download: Hustler Taboo Download or Read Online eBook hustler taboo in PDF Format From The Best User Guide Database

Jurnal Kesehatan, Vol. 8, No. 1, September 2015

Jurnal Kesehatan Vol 8 No 1 September 2015

Jurnal Kesehatan, Vol. 8, No. 1, September 2015 4 KATA SAMBUTAN Puji syukur ke hadirat Tuhan Allah SWT, karena berkat pimpinan dan ridhonya sehingga Jurnal Kesehatan Volume 8 Nomer 1 bulan September tahun 2015 ini telah diterbitkan. Jurnal ini disusun untuk memfasilitasi karya inovatif dosen di seluruh jawa timur untuk

TRADELINE ? Product Cross Reference - On Time Direct

TRADELINE Product Cross Reference On Time Direct

70-6630 rev. 11-06 2 02-0954 carrier functional r4214g 1032 trade 02-2400 hydrotherm functional l8124c1003/u trade 02-2800 hydrotherm functional l4006e1000/u trade

U.S. Mandatory Toy Standard: ASTM F963 -

U S Mandatory Toy Standard ASTM F963 CPSC gov

U.S. Mandatory Toy Standard: ASTM F963 JhMid PhDJonathan Midgett, Ph.D. Office of Hazard Identification and Reduction December 2009December 2009 These comments are those of the CPSC staff, have not been reviewed or approvedb d t il fl tth i f th C i id by, and may not necessarily reflect the views of, the Commission.

A Rough Guide to Reading Partners -

A Rough Guide to Reading Partners education ie

A Rough Guide to Reading Partners A cross-age, peer-tutoring approach This NEPS Good Practice Guide was developed by educational psychologists.

1500 Starting Watts / 1200 Rated Watts PORTABLE GENERATOR

1500 Starting Watts 1200 Rated Watts PORTABLE GENERATOR

Make certain that the generator is resting firmly on level ground . When operating the generator: DO NOT move or tip the generator during operation . DO NOT tip the generator or allow fuel or oil to spill . When transporting or servicing the generator: Make certain that the fuel shutoff valve is in the off position and the fuel tank is empty .

Holt McDougal Larson Pre-Algebra

Holt McDougal Larson Pre Algebra

Holt McDougal Larson Pre-Algebra Practice Workbook LAHPA11FLPW_FM_00i-0iv.qxd 1/20/11 1:44 PM Page i S-81 Mac OSX:Users:s81:Desktop: