Exploring a variety of Python development languages

Source: Internet
Author: User

The admin Function of Django is called the killer feature of django. This is a perfect example. From the example I made, when I was doing a website, basically, you only need to pay attention to the display of the front-end page.

The background functions are basically automatically available. For example, I used a second-hand information publishing platform, category is a second-hand information type, and there is also an information class, the relationship with category is many-to-one, so in the background, the crud of category and information is automatically produced, because category itself is a self-Association.

Therefore, when adding category in admin, admin will automatically select a parentCategory according to the definition of my model. On the add information page, admin will ask me to select a category to create an information.

In the past, in java, all these work had to be done by myself. Of course, there are also many tools that can automatically produce crud. python, however, these open-source tools are basically for a single model, in addition, the generated code must be greatly modified to truly run the function.

The most important thing is that the management of associations cannot be automatically generated. Of course, I have also seen a company develop a database-driven code producer that can generate complete and available code and pages, as well as link processing. However, due to the differences in language features.

During development, we still need to constantly restart the server to display the results. Although technically, it is not difficult to implement this function for ssh, it will consume a lot of time on it, if it takes a lot of time, few companies will contribute.

Therefore, I personally think that django is doing very well in this function, especially this function can save developers a lot of time. In some cases, the project can be executed in two lines. The user enters data through admin and the programmer develops the foreground. After the foreground function is completed, the data is also available and the test is available. This feature is especially important for small projects that require rapid development, because django is generated based on this scenario.

Of course, sometimes the background is not so simple, but fortunately, admin provides the extended function. We can write the extended code ourselves and then integrate it into admin, however, apart from the admin template, we cannot change any admin code.

However, I often wonder if admin supports the function of automatic code generation. We can modify the background functions at will. Otherwise, we need to write our own code, it is not as convenient to expand the generated code.
To use admin, you must open the django permission module.

Here is a brief introduction to the permission module. django comes with a permission module. The model in this permission module is no longer familiar to those who are familiar with permissions, such as user, group, permission, many-to-many user and group, and many-to-many group and permission.

In acegi, we usually define python, role, and resource as follows. This permission is the same as that in django, but the default permission granularity in django is very rough, it is based on the model. If we want more detailed permission modules, we need to expand them ourselves.

Let's take a look at the general mode of fastcgi: 1. The WEB server receives the page request from the client. 2. The WEB server delegates the page request to a FastCGI external process. The WEB server uses socket to connect and communicate with FastCGI) 3. FastCGI external processes are processed after the page request information delegated by the WEB server is obtained.

And the dynamic page content of the processing result) is returned to the WEB server 4. The Web server forwards the result returned by FastCGI to the client browser. For us, step 1 is our most important concern, because the speed of step 2 seriously affects the overall performance.

Fastcgi is based on processes. Therefore, we need to enable a suitable number of fastcgi processes based on our applications. opening more processes is a waste of resources, and the performance is affected if we do not do so, this is similar to the thread that enables request processing in tomcat, but the request handler thread in tomcat is obviously more convenient to configure, because we only need to pay attention to the maximum number of threads that can be accommodated in the thread pool, the maximum number of Idle threads is enough.

  1. Introduction to Python system files
  2. How to correctly use Python Functions
  3. Detailed introduction and analysis of Python build tools
  4. Advantages of Python in PythonAndroid
  5. How to Use the Python module to parse the configuration file?

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.