Introduction to the Python WEB development framework

Source: Internet
Author: User
1. Django

Django
Django is oriented to programmers who deal mainly with content. the makers of Django are from the newspaper business. they say that they were often asked to implement certain features on their web site with tight deadlines. so they wrote their own framework. django does not re-use existing components. even their way to access databases (the so called object-relational mapper) is home-made.

If you have similar requirements as Django's makers you will find that it is an excellent framework. but it is not meant to have its components replaced easily in case you don't like them. their templating language is not very "pythonic"-it is a language of its own although an easy one. A nice feature is their admin frontend-it will create HTML forms for you to easily manage the data in your database. and it comes with a nifty way to map URLs to certain functions in your application based on regular expressions.

AJAX is basically possible with Django but not very comfortable. they have a web server built in but they suggest you run Django applications on an Apache with mod_python. one thing that can truly be said about Django: they have good marketing. django is well known ented, has a large community and there is even a book currently written. all in all Django is a "don't worry-be happy" framework that is tightly integrated and which will help you get things done quickly if you don't care too much which components it uses and don't have CT all parts to look perfectly pythonic. it's a bit magical.

Django is intended for programmers who mainly process content. Django creators originated from newspaper business services. They reflect that they are often asked to implement specific features on their websites within a short period of time. So they wrote their own framework. Django does not reuse many components, even if the way they connect to the database (the so-called object-link mapper) is self-made.

If you have a requirement similar to that of the Django creator, you will find that this is an outstanding framework. But that doesn't mean you can replace them easily if you don't like them. Their template language is not very similar to Python-it has its own language, even if it is very simple. A very good feature is their management backend-it will generate HTML format for you to easily manage data in your database. At the same time, it is inherent in a playful way in your application based on regular expressions to locate the URL to a specific function.

Ajax is basically supported in Django, but it is not very comfortable to use. It has built-in Web servers, but we recommend that you use mod_python to run applications on Apache. One thing about Django is the fact that it has a good market prospect. Django has a very good document, a very large community, and a book is being compiled. In general, Django is a "Don't worry, be happy" framework, it is tightly integrated, and if you don't care too much about which parts it uses and don't want all parts to be perfectly pythonic, it helps you complete the task quickly. It is magical.

Summary: Django advantages: the documentation is well supported, the community support is strong, the admin management background is very powerful, and the syntax is magic.

Disadvantage: Ajax is not supported enough, and it is difficult to replace components.

Ii. turbogears

Turbogears makes use of existing components. their Web server runs on cherrypy, their HTML templates come from kid, they access databases through sqlobject and even include a good way to write interactive Ajax applications through the use of a javascript library called mochikit that is tightly integrated.

They make it easier than Django to replace certain components in case you don't like them. for example you can throw away sqlobject and use sqlalchemy instead; although skip parts of turbogears still lack full support for sqlalchemy. turbogears's URL Mapping scheme is less explicit. you can't tell what is supposed to happen for certain URLs. instead a program of the same name as the first part of the URL is called. so the URLs the user sees may appear less nifty.

A nicer feature is their set of web-based utilities. among them is their widgetbrowser to browse the library of supplied form elements-or catwalk-A database administration frontend similar to that which Django provides. turbogears is well known ented and has a large community, too. all in all turbogears has nifty features like its widget library or a good set of utility functions that make life easier.

Its documentation is somewhat incomplete and contains recipes and examples rather than a nice reference. A move to sqlalchemy has been publicly announced but has features currently only work well with sqlobject. turbogears may be a nice choice for programmers who are scared by the magic of Django and like it a bit more explicit.

Turbogears consists of existing parts. Its Web server runs on cherrypy, and its HTML template comes from kid, it connects to the database through sqlobject and even contains a good way to write interactive Ajax applications by using a tightly integrated JavaScript library called mochikit.

Compared with Django, if you do not like several components, turbogears is easier to replace them. For example, you can discard sqlobject and use sqlalchemy, even if many parts of turbogears lack full support for sqlobject. The URL positioning structure of turbogears is relatively unclear. You do not know what should happen to a specific URL. On the contrary, programs with the same name as the first part of the URL are called up. Therefore, the URL you see is not as playful as Django.

A better feature is a set of practical network-based functions. A plugin browser that supports files-or catwalk-for a database backend management, similar to what Django provides. Turbogears has good documentation and a large community. In general, turbogears has excellent features such as its plug-in library or a set of good practical functions, making your work easier.

Some of its documents do not fully contain tips and case code, rather than a good reference. The migration to sqlalchemy has been announced to the public, but currently many features are only fully compatible with sqlobject. Turbogears is a good choice for programmers who are afraid of Django's magic and love to be clear.

Summary: Advantages of turbogears: excellent documentation support, strong community support, replaceable components, clear syntax, good plug-in library, and a set of good practical network functions.

Disadvantage: incomplete documentation, incomplete support for some replacement components, and unclear URL positioning.

Iii. pylons

Pylons isn' t exactly new but appears to have a smaller community than Django or Turbogears. that does not mean it's technically worse than other frameworks. it is unique in that it is more minimal and flexible than other frameworks. basically you need to learn the basics of the components it uses. next you need to understand how these components are controlled from within a Pylons application. so Pylons is the glue between the components with an additional powerful package called "Webhelpers" that aids in getting areas from AJAX to RSS feed creation.

Pylons 'flexibility means that you can exchange the components very easily. You don't like sqlalchemy? Use sqlobjects. You read that myghty is superseded by Mako? Use Mako. pylons may not always hold your hand but it will try to make it easy to use different components than what pylons uses by default. and you will likely be happy with what pylons offers by default. the components are carefully chosen by looking at what other Web frameworks do wrong.

The documentation for pylons is still lacking and there is no "pylons handbook" yet. it seems like some fans of pylons tried it because they generally liked the idea of Web frameworks but were frustrated with Django or turbogears.Some say that Pylons is the Ruby-on-Rails written in Python.

 

Pylons is definitely not new, but less community than Django and turbogears. This does not mean that it is technically worse than other frameworks. It is quite special because it is more lightweight and flexible than other frameworks. Fundamentally, you need to understand the basis for using components. Next, you need to understand how these components are controlled in a pylons application. Therefore, pylons uses an additional package called "webhelpers" To Create Ajax for RSS feed in many fields. It is very helpful for these components.

The flexibility of Pylons means that you can easily replace components. Do you not like SQLAlchemy? Use SQLObjects. Have you learned that Myghty is replaced by Mako? Use Mako. Pylons may not always work side by side with you, But it tries to make it easier to use different components than to use default components. You may also like the default components provided by Pylons. Pylons carefully selects components by observing the mistakes made by other web frameworks.

Documentation for Pylons is still very lacking. There is no Pylons manual. Some followers of Pylons tried to write it because they liked the idea of this web framework but were confused by Django and TurboGears. Some people say that Pylons is a Ruby on Rails written in Python.

Summary: Pylons advantages: it is lightweight, more flexible, and can be replaced and supports complete components. Default components absorb the experience of other web frameworks. Like Ruby on Rails.

Disadvantages: documents are very lacking and community support is insufficient. You need to understand the basic knowledge of each component and how to be controlled.

My words

I think I can learn English, but Python is just getting started. I only have a preliminary understanding of these web frameworks. I cannot talk about any practical experience, and I am not accurate enough to translate some professional words,.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.