Python Web framework introduced

Today, there are a lot of Python framework to help you more easily create web applications. These frameworks to organize the appropriate module, making the time to build applications more quickly, do not take some of the attention to detail (such as socket and protocol), so needed in the framework. Next, we will introduce the different options.

Python originated in the late 1980s. Developers are Centrum Wiskunde & Informatica's Guido van Rossum, this is a mathematics and computer science research center is located in Amsterdam Science Park. After Van Rossum has been a very influential figure in the Python development. In fact, community members gave him a honorary title: ** lifelong benevolent person (BDFL).

After the initial humble, Python has become one of the Internet's most popular server-side programming language. W3Techs according to statistics, it is used in many large traffic sites, more than ColdFusion, PHP, and ASP.NET. Wherein more than 98% of the site running Python 2.0, only a little more than 1% of the operating site 3.0.

Framework allows developers to more easily

Today, with a large number of Python framework that allows the development of web applications easier. These frameworks to integrate different modules together to make you faster architecture program, without attention to some details (such as socket and protocol), the framework provides all the features needed.

As the first part of the series into a two-part article, we will introduce some of the most popular Python frameworks. Although most modern web framework running on the server side, there are some began to try to frame combined with client-side code can be run on the client (for example Skulpt and Trinket). Python framework is usually divided into full and part-stack frame stack frame. Full-stack framework design experience from the user to the database of all technical, non-full-stack framework does not contain all of the technology throughout the development.

There is also a micro-framework, also belong to the non-full-stack framework, but more lightweight. In some cases, micro framework is more appropriate, and sometimes for the use of full-stack framework. In the second part of the article we will have full-stack framework and micro framework to make a comparison.

Django

Django is probably the most representative of the Python framework. It is an open source framework MMVC follows architectural pattern. Its name comes from Django Reinhardt, a French composer and guitarist, a lot of people think he is the greatest guitarist. Kansas City is located in Lawrence Island in the Lawrence Journal-World newspaper has two programmers, Adrian Holovaty and Simon Willison, they developed in 2003 when Django, a newspaper for developing web applications.

Django built-in template engine, but also to support the popular Jinja2 engine by OOTB. It also supports regular distribution of the URL, it can be done through a simple mapping complex URL.

One of the advantages of Django only requires a separate installation package to install. Some other similar frameworks need to download a lot of components to begin work. Moreover, Django also perfect to keep updated documentation for open-source projects, which are usually short board. It is a robust framework, a lot of well integrated plug-ins and extensions from the community. Community behind the project looks well organized, which can be seen from its very comprehensive documentation and tutorials.

TurboGears

TurboGears is a framework built up over several prominent Python projects such as SQLAlchemy, WebOb, Repoze, Genshi. In a sense, TurboGears is bonded together more established open platform. And Django, it uses MVC architecture. Recently it also contains a "minimum pattern", so that it can be used as a micro-frame.

TurboGears by Kevin Dangoor developed in 2005. He will publish it in September of that year as an open source project. In 2013, the project developer to migrate to support Python 3, abandoned them once wrote Pylons code. TurboGears advantages include:

Supports aggregation
powerful object-relational mapper
transaction system supports multi-database transactions between
multi-database support
with reusable code fragment as a template
with a lot of flexibility to the docking of non-standard components
support fragmentation
template system to make it easier for the designer

Some disadvantages include TurboGears more basic management functions, fewer third-party applications, and only the primary documents. A major challenge is its overwhelming TurboGears. Because the other components of the mix and match it offers unlimited flexibility when trying to decide which path to complete a task it is too complicated.

web2py

web2py is an open source framework that allows developers to quickly create dynamic, interactive Web site. Its design goal is to eliminate the large number of repeat programming tasks slow down the development of, for example, create a basic form. It was originally developed as a tool. Then imitate Django and Ruby on Rails, Ruby on Rails is a framework for Ruby. Like TurboGears, it uses the MVC architecture.

The beginning of the source code is open in the year 2007 by the Massimo DiPierro. At that time, it was known as Enterprise Web Framework (EWF). Due to naming conflicts, it is the name to turn over several times, the last in the current version 1.16 is determined to web2py. Applications developed using web2py includes Movuca content management system, music site NoobMusic, network diagnostic tool called LinkFindr, and Instant Press blog platform. In 2011, web2py was named the best open source software development, won the Bossie Award. The next year, but gains InfoWorld's Technology of the Year Award.

Like with Django, web2py also has a wide range of documents. New developers and senior developers can download it free handbook complete development.

Some advantages web2py comprises:

Easy to use - as a full-stack framework for a robust, it can work without having to rely on others, easy to learn and deploy, install and without any configuration file Once downloaded and installed, it can be used. Developers will get a database, a web-based IDE, a powerful web server and multiple core API objects.
Excellent safety --Web2py template language reduces the risk of hackers using cross-site scripting, abstraction layer form field validation check when you create a form, to avoid SQL injection, also prevents cross-site request forgery attack (csrf attack). Session is stored on the server, to prevent bad actors to mess up your browser cookie, and after each password hash is stored.

Web2py includes some drawbacks:

Use management interface on a regular basis is not easy to
manage interface does not have permission to
no built-in unit testing support
rapid development speed, all functions have default behavior, the form is automatically generated, high-level widgets and web applications grid is built.

Flask

Flask is a python-based Jinja2 and the micro-Werkzeug framework, and other similar framework, it is BSD licensed, a small amount of free software license restrictions. Flask use of the site include LinkedIN LinkedIn and Pinterest. Flask has the following characteristics:

Built-in unit testing support
template Jinjia2
large number of documents
the client session using secure cookies
development server and debugger
Restful request
with WSGI 1.0 compatible
based on unicode
number of extensions Flask is a young framework, born in 2010, the goal is not to give Flask programmers impose restrictions, allowing you to use your own database object-relational mapping, other components required template engine, middleware and session your project, in my opinion this is the intention of this micro-framework. I want to say like this Flask framework more suitable for experienced developers, not small-scale applications must, of course, if you just want to do a simple REST API, then Flask of course, could not be better.

Bottle

Bottles (Bottle) and the same flask, Bottle server is a gateway interface (the WSGI) network frame. As a document, it does not depend on any library outside the Python standard library. Marcel Hellkamp writing it in 2009 when it only starting from the smallest tool includes templates, routing and a WSGI abstraction layer. For programmers looking for basic functionality and flexibility to build simple applications and Web sites to create a Web API, this small and powerful framework is excellent.

Its advantages include:

Built-in support for fast template engine and Jinja2, Mako and the Cheetah
can access to upload a large number of tools cookies, form data, title, and other metadata
support fapws3, Google App Engine, CherryPyPaste development of the built-in HTTP server
supports dynamic URLs

Bottle Another advantage is that it is compact and easy to crack embedded in a larger application program without worrying about the system dependencies. If you want a simple, clean and fast framework and it does not have too much redundancy, to create a small application, Bottle is right for you.

Multi-frame

Although hard to believe, but these are just a few of dozens of developers can use Python framework. Python.org reported, Django, TurboGears and complete web2py is the most popular option. In order to provide a comprehensive view of the optimization framework, where we added two advanced form of miniature frame. Has a passionate followers of other frameworks include Pyramid, web.py, Bobo, Albatross, and CherryPy.

Finding the right fit selection

Choosing the right frame depends on the size of the project, its communication needs, whether it is a stand-alone application, the level of demand for customized, cost, and many other factors. Equally important it is that it depends on which framework suits your personal way of working. Review these projects and download their latest version. Before planning a major trip, make sure you try to open it in a suitable vehicle.
More privileged operation

Well today is more than knowledge, I hope you remember that this is the basis of this foundation. Writing is not easy, we at least look at it. There are puzzled friend asked in the comments section, I'll try and answer. Partners interested in small, can add my QQ group study together oh: 1084028245. Our next goodbye!

Released eight original articles · won praise 1 · views 138

Guess you like

Origin blog.csdn.net/weixin_46606335/article/details/105258154