What are the limitations of Django?

Source: Internet
Author: User
Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... Reply: The Limitations of Django are nothing more than encapsulation too much is not general enough, the flexibility is not enough, the middleware does not follow the WSGI protocol itself is relatively closed, ORM/Template performance is not good.

For beginners, there is no need to consider its limitations. Django is well encapsulated and beginners can quickly make an application. When you really feel that its limitations have affected you, I believe you have the ability to jump out of its limitations.

So you don't have to worry too much about it. you have to make things first. it's no shame to be a beginner, Quick and Dirty. This answer has been rewritten ......

The biggest problem with Django is that it has designed a set of requirements for you and has provided functions to address these requirements. What you need to do during usage is not to analyze the requirements and develop them with the assistance of Django, but to enable these functions of Django according to the instructions in the manual. That is to say, you already have a formed hammer, which can only be used to pin the nails that it can nail.
If your requirements cannot be covered by Django's design, what you can do is modify the requirements rather than modify the application. Because Django has been heavily designed, it is costly to modify it again.

In a word, Django is not a framework, but an application manages static resources much different from Rails Asset pipeline. Not only official staticfiles, but some third-party asset manager plug-ins have been tried, and Sprockets is not easy to use. Therefore, an empty Rails project was created to process Assets, then let Django call these resources through the manifest file.

NoSQL databases are not officially supported. Although other frameworks do not seem to have official NoSQL support, because Django ORM is deeply coupled with other components, if you replace Django ORM with a NoSQL ORM, other components are useless. At present, the branches of Django NonRel can support MongoDB and some other NoSQL databases. although it is very useful, it is not an official branch. in order to be compatible with the upstream version, it requires a lot of extra costs. Django's limitations (compared with web. py) may be too much encapsulation. You can use django to build a blog (Baidu) within ten minutes, but it also means that it has done a lot of work behind the scenes for you and may not be optimal. In my opinion, the idea of Python is to display the declaration, and everything should be clearly stated, rather than by default. Therefore, if django wants to do a good job, you may have to thoroughly understand it and improve it.
If you have a deep understanding of its code, maybe it can make it better, as long as it is suitable for you, it is the best framework. I have been using django 0.96 and have been watching django grow.
The most criticized part of django is the heavy ORM and poor template performance. However, what I want to talk about is what is often said by others, in fact, django provides alternative solutions.
ORM: If you are too troublesome to write Model, just want to execute raw SQL, then you can refer to the https://docs.djangoproject.com/en/1.4/topics/db/ SQL/ Even if you only use this part, you can also get a lot of benefits. you don't have to worry about whether the database is using MySQL or PostgreSQL, so you can easily create and automatically close the database link. If you think Django's ORM is too bad, you can build your own django ORM on this basis, but please consider the risk of SQL injection yourself.
Template performance: templates are used only when you return web requests. if you like them, you can use other template systems, such as jinja.

If you want to write a hello world project, other lightweight frameworks will look like several lines of code. Django requires you to run a bunch of commands such as startproject and startapp, which seems very troublesome. However, as the project grows and you need to integrate more and more things, you will find that django can save more time for you. Want a simple and customized background data management? Django admin is too convenient. Want a user registration system? There are also a lot of built-in and various online apps. Want to automatically process the time zone? Want to have a multilingual website interface? And so on. The django \ utils directory of django is also a good treasure. many practical small functions and classes can often be found here.

If there are any limitations, the combination of django and js is indeed much worse than that of rails, and self-deployment is also troublesome (but now there is a fast deployment service like dotcloud ). Laxatives. I am not good at it. I will invite you to join me.

To put it bluntly, I am afraid the biggest limitation is that there are few hosts that support python.

However, since you only need a host in the initial stage, it is always possible, so this is not a big problem. -- If you use VPS or physical hosts, this is even more of a problem. Some people have discussed the limitations of django, I will reference it here, you can see the following two blog posts: http://www.cnblogs.com/zhengyun_ustc/archive/2006/11/19/564917.html
Http://cookoo.iteye.com/blog/33182 If the downsides of each upgrade are not compatible, this is my biggest dissatisfaction. Performance depends on the application. These two articles have actually taken a long time. the Django program mentioned in the article is often modified. in the past two years, the Django program has always been modified, roR often has incompatible updates. Many friends have been stepping on mines, and Django is quite variable.

I don't think there is any limit. It can only be used to pin a nail that can be nailed.
If your requirements cannot be covered by Django's design, what you can do is modify the requirements rather than modify the application. Because Django has been heavily designed, it is costly to modify it again.

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.