What frameworks are available in python?
A few days ago, a friend left me a message saying: When will there be a useful summary of the Python framework (the list in this article is only a part, and does not include all Python frameworks), so today's article was born. (Suddenly I feel very nice)
Recommended one: Django (Recommended learning: Python video tutorial)
Django should be the most famous Python framework, GAE and even Erlang have frameworks affected by it. Django is taking a big and comprehensive direction. It is most famous for its fully automated management backend: just use the ORM and make simple object definitions, and it can automatically generate a database structure and a full-featured management backend.
Advantages:
Open source framework, with perfect documentation support
Many solutions, more internal function support
Elegant URL, complete routing System
Self-service background management
Disadvantages:
The system is tightly coupled, and it is very difficult to replace it with your favorite third-party library, even with some patches. It will also feel very awkward when you get on it.
The ORM that comes with Django is far less powerful than SQLAlchemy.
Template function is relatively weak and cannot insert Python code. To write more complex logic, you need to use Python to implement Tag or Filter.
Recommendation 2: Flask
Flask is a lightweight web application framework written in Python. Based on Werkzeug WSGI toolbox and Jinja2 template engine. Flask is also called a "microframework" because it uses a simple core and uses extensions to add additional functionality. Flask does not have a database or form validation tool used by default.
Advantages:
Flask is more flexible than Django. Before using Flask to build an application, it will give developers more flexibility when selecting components. Some application scenarios may not be suitable. Use a standard ORM (Object-Relational Mapping), or need to interact with different workflow and template systems.
Disadvantages:
Flask is just a kernel and relies on two external libraries by default: Jinja2 template engine and Werkzeug WSGI tool set. Many other functions are embedded in the form of extensions.
Recommendation 3: Scrapy
Scrapy is a fast, high-level screen scraping and web scraping framework developed in Python, used to scrape web sites and extract them from Extract structured data from the page. Scrapy is widely used and can be used for data mining, monitoring and automated testing.
Advantages:
Scrapy is a very powerful crawler framework. It can not only easily construct requests, but also has a powerful selector that can easily parse responses. However, its most popular Its performance includes the speed of crawling and parsing, its downloader is multi-threaded, and requests are scheduled and processed asynchronously. These two points make its crawling speed very fast.
In addition, there are built-in logging, exception, shell and other modules, which bring a lot of convenience to crawling work.
Disadvantages:
Scrapy is an encapsulated framework. It includes a downloader, parser, log and exception handling. It is based on multi-threading and twisted processing. For crawling a single website, It has advantages in development, but for crawling 100 websites from multiple websites, it is not flexible enough in terms of concurrent and distributed processing, and it is inconvenient to adjust and expand.
Recommendation 4: Tornado
Tornado is an open source version of web server software. There is a clear difference between Tornado and today's mainstream web server frameworks (including most Python frameworks): it is a non-blocking server and quite fast.
Advantages:
Tornado excels at providing infrastructure for applications that require tight control over the details of asynchronous networking. For example, Tornado not only provides a built-in asynchronous HTTP server, but also an asynchronous HTTP client. Therefore, Tornado is ideal for building applications, such as web scrapers or bots, that query other sites in parallel and operate on the returned data.
Disadvantages:
There are many third-party modules to choose from in the template and database parts, which is not conducive to encapsulation into a functional module.
Recommendation 5: Web2py
web2py is a full-featured Web application framework provided for the Python language. It is designed to develop Web applications agilely and quickly, with fast, safe and Portable database-driven application, compatible with Google App Engine.
Advantages:
The biggest attraction of Web2py is its built-in development environment. When you set up a Web2py instance, you are given a web interface, effectively an online Python application editor, where you can configure the components of your application. This usually means creating models, views, and controllers, each described through Python modules or HTML templates.
Disadvantages:
One important limitation of Web2py is that it is only compatible with Python 2.x. First this means that Web2py cannot use Python 3's asynchronous syntax. If you rely on external libraries that are unique to Python 3, you're out of luck. However, work is underway to make Web2py Python3 compatible and it is nearing completion at the time of writing.
Recommendation 6: Weppy
Weppy feels like the middle mark between the minimalist style of Flask and the completeness of Django. While developing Weppy applications has the directness of Flash, Weppy has many features found in Django, such as data layer and authentication. Therefore, Weppy is suitable for applications ranging from extremely simple to moderately complex.
Advantages:
Weppy’s documentation has the same style as the framework itself. It's clean, readable, and intended for human consumption. In addition to the usual "hello world" application examples, it also contains a good walkthrough tutorial that allows you to create a Weibo system as a beginner project.
Disadvantages:
Although Weppy has an extension mechanism, the list of officially approved add-ons is small, much smaller than Flask’s extension directory.
Recommendation 7: Bottle
Bottle can be considered a mini-flask because it is more compact and concise than other "micro-frameworks". Due to its minimal footprint, Bottle is ideal for inclusion in other projects or for quick delivery of small projects such as REST APIs.
Advantages:
Bottle does not require as much documentation as other frameworks, but the documentation is by no means stingy. All the key stuff fits into a single (albeit long) web page. In addition to this, you'll find full documentation for each API, examples of how to deploy on various infrastructures, explanations of the built-in templating language, and a collection of common recipes.
Disadvantages:
One consequence of Bottle’s minimalism is that some features simply don’t exist. Form validation, including CSRF protection and other features, is not supported. If you want to build a web application that supports a high degree of user interaction, you will need to add them yourself.
For more Python related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of What frameworks are available in python?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

VS Code can run on Windows 8, but the experience may not be great. First make sure the system has been updated to the latest patch, then download the VS Code installation package that matches the system architecture and install it as prompted. After installation, be aware that some extensions may be incompatible with Windows 8 and need to look for alternative extensions or use newer Windows systems in a virtual machine. Install the necessary extensions to check whether they work properly. Although VS Code is feasible on Windows 8, it is recommended to upgrade to a newer Windows system for a better development experience and security.

To run Python code in Sublime Text, you need to install the Python plug-in first, then create a .py file and write the code, and finally press Ctrl B to run the code, and the output will be displayed in the console.

VS Code can be used to write Python and provides many features that make it an ideal tool for developing Python applications. It allows users to: install Python extensions to get functions such as code completion, syntax highlighting, and debugging. Use the debugger to track code step by step, find and fix errors. Integrate Git for version control. Use code formatting tools to maintain code consistency. Use the Linting tool to spot potential problems ahead of time.

Running Python code in Notepad requires the Python executable and NppExec plug-in to be installed. After installing Python and adding PATH to it, configure the command "python" and the parameter "{CURRENT_DIRECTORY}{FILE_NAME}" in the NppExec plug-in to run Python code in Notepad through the shortcut key "F6".
