What is Django or what does Django do ?, Django or

Source: Internet
Author: User

What is Django or what does Django do ?, Django or
What is Django?

Django is a Python-based Web application framework. The biggest difference between Flask and another Python Web framework is that it pursues the philosophy of "Everything is included. This idea is: all the common functions required to create a Web application should be included in the framework and should not be included in an independent software package. For example, functions such as identity authentication, URL routing, template system, Object Relational ORM ing (ORM), and database migration are included in the Django framework. Although it seems that you have lost some elasticity, it can make your website more efficient.

Django was initially developed to manage some news-based websites under the Lawrence Publishing Group. Therefore, we can find that many Django websites are used as CMS (Content Management System. Shows some well-known websites using Django:

How Django works

Django is an MTV framework, and its architecture template does not seem very different from the traditional MVC Architecture. Django further splits the view in MVC into two parts: the Django view and the Django template, which determine "what data to display" and "how to display" respectively, so that the Django template can be replaced at any time as needed, it is not limited to built-in templates. The MVC controller is implemented by URLconf of the Django framework.

Specific process:

  • HTTP request in the browser;
  • Django is allocated to the corresponding View according to the URL configuration;
  • View to perform database operations or other operations;
  • The View layer sends data to the Template for rendering and returns the HttpResponse content;
  • The browser displays the webpage content based on HTTP response.

The core of the Django framework is an object-oriented Er (ORM), which is used as a medium between data models (defined in the form of Python classes) and relational databases; a URL distributor based on regular expressions, a view system for processing requests, and a template system. In addition, it also includes:

  • A lightweight and independent Web server for development and testing.
  • A form serialization and verification system is used for conversion between HTML forms and data stored in databases.
  • A cache framework with several caching methods available.
  • Middleware support allows interference in each stage of request processing.
  • The built-in distribution system allows components in applications to communicate with each other using predefined signals.
  • A serialization system can generate or read Django model instances in XML or JSON format.
  • A system used to expand the capabilities of the template engine.
  • A Scalable authentication system that allows you to quickly develop user session functions by checking user logon and permissions.
  • Internationalization: the built-in internationalization system facilitates the development of websites in multiple languages.
  • Automated Management Interface: you do not need to spend a lot of work to create personnel management and update content.
  • A group of tools that generate RSS and Atom and that generate Google site maps (Google Sitemaps)
  • A set of template libraries supporting lightweight Markup Language (Textile and Markdown)
  • A basic framework to assist in the creation of geographic information systems (GIS)
  • A flexible comment System
  • Cross-site request forgery tools
Advantages and disadvantages

Django's main goal is to make it easy to develop complex, database-driven websites. Django focuses on Component reusability and "pluggable", agile development and DRY rules (Don't Repeat Yourself ). Python is widely used in Django, including configuration files and data models.

Advantages of Django:

  • The perfect documentation is Django's almost perfect official documentation.
  • Full-stackframework + batteries customization ded (full-stackframework + batteries). What are the basic requirements (such as cache, session, feed, orm, geo, and auth), and all are created by Django, the Django tool used for website development is basically ready for you, so the development efficiency is needless to say.
  • Powerful URL routing configuration, Django allows you to design very elegant URLs.
  • The self-help management background allows you to have a complete background management interface without having to write a line of code.

Django's disadvantages: (it comes from Django's insistence on making all its own wheels, and the entire system is relatively closed)

  • The system is tightly coupled. If you think that a built-in function of Django is not very good, it is very difficult to replace it with a third-party library you like, such as The ORM and Template. It is almost impossible to use SQLAlchemy or Mako in Django. Even if some patches are used, it will make you feel very awkward.
  • The built-in ORM is far less powerful than SQLAlchemy. SQLAlchemy is the de facto ORM standard in the Python world. Other frameworks support SQLAlchemy, but Django still sticks to its own one.
  • The Template function is weak and cannot insert Python code. To write complicated logic, you must use Python to implement Tag or Filter.
  • Although the URL configuration is powerful, it must be written by hand. There is a big difference between the experts and the URLs configured by the people who first know Django.
  • Django's auth is closely integrated with other modules, and features are quite powerful, but it is a bit too much. Your database schema has been set for you. For example, many websites require unique email addresses, the value of this field in the schema is not unique.

Related Article

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.