Python has a wide range of applications in web development. In view of the various frameworks, how to choose will become a problem for developers. To this end, I hereby conduct a rough analysis of the more common frameworks in terms of performance, experience and application.
1 Django
Django is an open source web application framework, written in Python. The framework mode of MTV is adopted, namely model M, template T and view V. It was originally developed to manage some news content-based websites under the Lawrence Publishing Group, which is CMS (Content Management System) software. Compared with other frameworks, Django has a unique feature. It supports orm and encapsulates the operation of the database into python, which is a better feature for applications that need to apply multiple databases. However, this feature has been completed by other libraries, sqlalchemy.
2 Flask
Flask is a lightweight web application framework written in Python. Its WSGI toolbox uses Werkzeug, and its template engine uses Jinja2. Flask uses BSD authorization.
Flask is also called "microframework" because it uses a simple core and uses extensions to add other functions. Flask does not have a default database or form verification tool.
Flask is very light, and a simple website can be developed at a very low cost. Very suitable for beginners to learn. After learning the Flask framework, you can consider learning the use of plug-ins. For example, use WTForm + Flask-WTForm to verify form data, and SQLAlchemy + Flask-SQLAlchemy to control your database.
3 Tornado
Tornado is an open source version of web server software. Tornado is obviously different from current mainstream web server frameworks (including most Python frameworks): it is a non-blocking server, and it is quite fast.
Thanks to its non-blocking method and the use of epoll, Tornado can handle thousands of connections per second, so Tornado is an ideal framework for real-time web services. However, compared with many frameworks, Tornado has been left behind, and Django has surpassed it, not to mention other frameworks. It can only be said that the performance of Tornado developed with pure python is still not comparable to the performance of other frameworks developed with cython. compared to.
4 web.py
web.py is a Python web framework, it is simple and powerful. web.py is public and there are no restrictions on what it is used for. And quite small, it should belong to a lightweight web framework. But this does not affect the power of web.py, and it is very simple and straightforward to use. In practical applications, web.py is more of academic value, because you can see more of the bottom layer of web applications, which you cannot learn from today’s "very well abstracted" web frameworks :)
5 Aiohttp
High-performance asynchronous web framework, both client-side and server-side, and also supports web-socket
6 Sanic
Similar to flask and supports asynchronous
7 Vibora
Aims to be the fastest python web framework. The high performance of vibora relies on the uvloop asynchronous framework implemented by cython and the http_parser implemented by cython, plus some web components built by cython, such as templates, user-routes, etc. It is still in the testing stage.
8 Bottle
Bottle is a simple and efficient WSGI-compliant micro python web framework. I say micro because it has only one file, and it does not depend on any third-party modules except the Python standard library.
9 Falcon
Falcon is a high-performance Python framework for building cloud APIs. It encourages the use of the REST architecture style and does the most with the least effort possible.
10 weppy
A full-stack web framework with better performance than flask.
Knowledge point supplement:
Misunderstanding of frame selection
With regard to the choice of framework, many people easily fall into the following two misunderstandings without realizing it:
Which framework is best-there is no best framework in the world, only the framework that suits you best and your team best. The choice of programming language is also a reason. If your team is most familiar with Python, use Python. If you are most familiar with Ruby, then use Ruby. Programming languages and frameworks are just tools. You can do more, faster, better, and less expensive. Finishing is a good thing.
Too much attention to performance-in fact, most people do not need to care too much about the performance of the framework, because the website you develop is a small website at all. There are not many websites with 10,000 IP addresses, and 100,000 is even more so. Seldom. It doesn't make much sense to talk about performance before a certain amount of visits, because your CPU and memory are always idle. Moreover, languages and frameworks are generally not performance bottlenecks. Performance problems most often occur in database access and file reading and writing. PHP's Zend Framework is notoriously slow, but Zend Framework also has big sites, such as digg.com; Ruby and Rails, which are often said to have performance problems, can still develop twitter? Moreover, the current hardware and bandwidth costs are actually very low. Especially with the cloud computing platform, the labor cost is the most expensive. Without tens of thousands of IPs, you don’t have to worry too much about performance issues. If the traffic goes up, spend some money to buy something. The server space is good, and the performance problem can be solved quickly and easily.
Note: Some netizens questioned me that "Quora is developed with Pylons" is not objective. I want to point out that a certain website A mentioned here is developed with B, but that A is mainly or partly developed by B , Everyone should stop entangled with A and C.
So far, this article on which web development frameworks in python are introduced is here. For more related python web development frameworks, please search for previous articles of ZaLou.Cn or continue to browse related articles below. Hope you will get more Support ZaLou.Cn!
Recommended Posts