StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

Django Web Framework - Essay Example

Summary
The essay "Django Web Framework" focuses on the critical analysis of the main peculiarities, advantages, and disadvantages of the Django web framework, based on Python and driven by URL. Developers can come up with their own URLs and decide what is to be shown for the URLs…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER95.4% of users find it useful

Extract of sample "Django Web Framework"

Django Web Framework Student’s Name Institution Django Web Framework Django is a web framework that is based on Python. It is driven by URL. In this regard, developers can come up with their own URLs and decide what is to be shown for the URLs. Since it is based on Python, Django provides developers with a standard way to code (Holocaty & Kaplan-moss, 2008). Developers have a standard way of syntax and calling methods and utilize the advantages provided by Python. Python has a clear syntax which is reinforced by a huge library of modules and standards which enables developers to perform almost everything they want including file zipping and multithreading. Since Python is object oriented, developers are able to relate real-world objects into their codes. Python also enhances performance through it runtime environment. Django enables developers to be able to utilize a variety of web servers including the not so known Apache, and various major operating systems such as Windows, Lnux, Mac, and UNIX. In addition, Django provides a layer that developers can use to access various database servers. Django utilizes MTV architecture which provides many advantages to developers. MTV architecture provides developers with data access and presentation layers and a way to view HTML tags on webpages. Django enables developers to switch from one database engine to another by configuring files thus enhances flexibility in case there is need to shift from one database to another (McGraw, 2009). With Django, developers find it easy when developing since it provides powerful templates thus makes developing faster. The framework provides developers with generic admin interface which enables them to control applications on the web while utilizing web portal (Holocaty & Kaplan-moss, 2008). Moreover, the framework provides developers with an environment to develop their applications, including lightweight web server, that are used for coding and testing applications. Developers can also test for errors in the codes they have created by enabling the debugging feature in Django. This enables developers to easily debug and locate errors in their codes. Django provides developers with a lot of packages that enables developers to reuse modules. In this regard, developers have the ability to log errors, deploy their applications automatically, integrate with social networks, and perform a lot of additional functions (McGraw, 2009). Creating webpages using Django enables web developers to build websites in phases. Django first requires developers to set up database using abstract representations known as modules, then create features via Django’s views, design the front end using templates, and combine them together via URL maps (Bennett, 2009). This idea enables web developers to create different independent websites and put them together instead of having their web development slowed down due to missing information required for a website. While using Django, developers do not need to worry about having to master complex languages of SQL or syntax for XML or HTTP as it translates database queries for developers and presents them in a manner that is easy to comprehend. Django allows the use of templates through the class Template in Python. The first stem is compilation of raw template code into Template object and then calling the render() function of the Template object. Creation of a template object requires instantiation of the object directly. Both Django and JSP support template inheritance. Therefore developers are able to call methods from a parent class instead of repeating the same code in the code they develop (McGraw, 2009). This minimizes the lines of code and gives developers easy time. The Django templating system provides a simple way of invoking methods in Python for additional functions. On the other hand, the JSP templating system provides a huge collection of features such as the . Django equivalent to servlet is Jython (Angelus, 2011). Jython is the execution of Python that runs on Java Platform. While Django and Jython run on Python, the jython command is used instead of python command. In addition, JYTHONPATH and not PYTHONPATH environment variable is used for Jython. Jython has much fewer numbers of lines of code compared to Java Servlets. While Java Servlets run on Java program, Jython servlets run with the help of PyServelet, which is a transitional Java servlet. Django has a database layer which enables developers to have great experience with their databases. After creating data models, Django gives developers abstraction API for database that makes them develop, recover, or remove objects (Bennett, 2009). In order to know whether to optimize for speed, memory, or both, it is prudent to identify the queries to be used in a database and the resources they would require. In order to filter data in the database, the filter and exclude commands are used. In case the filtering is to be done against other fields in the same model, the F() object query expressions is used. But in case the two commands do not produce the results desired, QuerySet.extra() is used to enable explicit addition of some SQL in the query. While retrieving individual objects, a column with unique or db_index is used together with get() in order to make the query to execute faster because of the database index beneath (Alchin, 2008). The all() method is used to retrieve all objects from a table in the database. However, when specific objects are needed, the QuerySet will be refined in two ways: filter(**kwargs) and exclude(**kwargs). The filter(**kwargs) provides results for objects that match the constraints being searched, and the exclude(**kwargs) provides results for objects that do not match the constraints being looked for. For instance, to obtain a QuerySet for information that has been entered in a database since the year 2006, the filter() function will be used as follows: Entry.objects.filter(pub_date_year=2006) (Forcier, Bissex, & Chun, 2009). Similarly, querying JDBC requires connecting the Java application to SQl database, creating ResultSet object, and executing the queries. Like when querying a database in Django, JDBC allows developers to get results of all objects they want or selected objects by the use of SELECT query. Since Django is a matured web framework, it is used by developers working on both big and small projects. In this regard, performance and concurrency are vital things to consider in the framework. Django offers the Deburg Toolbar which contains the query count feature that enables developers to measure the performance of their applications. The feature provides developers with the number of queries executed and the time they take to execute. Developers are therefore able to know the performance of their applications and made necessary adjustments. Django always develops a new database connection that persists every time developers apply to connect to the database. Developing new connections to the database any time they are needed is slightly expensive and can be solved by a connection pool. While Django do not have the tool that allows connection pooling on its own, there are various tools, such as the Django-PostgresPool, that allows the framework to pool connections. The tool therefore allows many connections or requests to be made to the database concurrently easily thus improving performance of applications developed. Since Django framework is based on a collection of small applications, each in charge of a particular subsystem, the performance is improved since each small program is responsible for working of a subsystem and not the entire system working together. Comparison of performance of different web frameworks is not very easy since it does not only involve knowing the speed of execution of a process but also aspects such as the number of concurrent processes running. References Alchin, M. (2008). Pro Django. New York, NY: Apress. Angelus, J. (2011). Django (Web Framework). Merseyside: Duct Publishing. Bennett, J. (2009). Practical Django projects. New York, NY: Apress. Forcier, J., Bissex, P. & Chun, W. (2009). Python web development with Django. Chicago: Addison-Wesley. Holocaty, A. & Kaplan-moss, J. (2008). The definitive guide to Django: web development done right. New York, NY: Apress. McGraw, J. (2009). Beginning Django e-commerce. New York, NY: Apress. Read More
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us