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

AI Hentai Generator
Generate AI Hentai for free.

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 and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

Enable PyTorch GPU acceleration on CentOS system requires the installation of CUDA, cuDNN and GPU versions of PyTorch. The following steps will guide you through the process: CUDA and cuDNN installation determine CUDA version compatibility: Use the nvidia-smi command to view the CUDA version supported by your NVIDIA graphics card. For example, your MX450 graphics card may support CUDA11.1 or higher. Download and install CUDAToolkit: Visit the official website of NVIDIACUDAToolkit and download and install the corresponding version according to the highest CUDA version supported by your graphics card. Install cuDNN library:

Docker uses Linux kernel features to provide an efficient and isolated application running environment. Its working principle is as follows: 1. The mirror is used as a read-only template, which contains everything you need to run the application; 2. The Union File System (UnionFS) stacks multiple file systems, only storing the differences, saving space and speeding up; 3. The daemon manages the mirrors and containers, and the client uses them for interaction; 4. Namespaces and cgroups implement container isolation and resource limitations; 5. Multiple network modes support container interconnection. Only by understanding these core concepts can you better utilize Docker.

MinIO Object Storage: High-performance deployment under CentOS system MinIO is a high-performance, distributed object storage system developed based on the Go language, compatible with AmazonS3. It supports a variety of client languages, including Java, Python, JavaScript, and Go. This article will briefly introduce the installation and compatibility of MinIO on CentOS systems. CentOS version compatibility MinIO has been verified on multiple CentOS versions, including but not limited to: CentOS7.9: Provides a complete installation guide covering cluster configuration, environment preparation, configuration file settings, disk partitioning, and MinI

PyTorch distributed training on CentOS system requires the following steps: PyTorch installation: The premise is that Python and pip are installed in CentOS system. Depending on your CUDA version, get the appropriate installation command from the PyTorch official website. For CPU-only training, you can use the following command: pipinstalltorchtorchvisiontorchaudio If you need GPU support, make sure that the corresponding version of CUDA and cuDNN are installed and use the corresponding PyTorch version for installation. Distributed environment configuration: Distributed training usually requires multiple machines or single-machine multiple GPUs. Place

When installing PyTorch on CentOS system, you need to carefully select the appropriate version and consider the following key factors: 1. System environment compatibility: Operating system: It is recommended to use CentOS7 or higher. CUDA and cuDNN:PyTorch version and CUDA version are closely related. For example, PyTorch1.9.0 requires CUDA11.1, while PyTorch2.0.1 requires CUDA11.3. The cuDNN version must also match the CUDA version. Before selecting the PyTorch version, be sure to confirm that compatible CUDA and cuDNN versions have been installed. Python version: PyTorch official branch

Updating PyTorch to the latest version on CentOS can follow the following steps: Method 1: Updating pip with pip: First make sure your pip is the latest version, because older versions of pip may not be able to properly install the latest version of PyTorch. pipinstall--upgradepip uninstalls old version of PyTorch (if installed): pipuninstalltorchtorchvisiontorchaudio installation latest
