Why do I learn django/flask, or do I not do web development?

Source: Internet
Author: User

It is believed that many friends have tried to use Django or flask to develop a website (the following is represented by Django). After all, the speed of development with Python is already several times faster, not to mention the Python-based web framework, the development of a website is sure to "click" to complete. But the reality is brutal, many people use Django, not only not to achieve "click" effect, but rather difficult to use Django to make a decent site. Clearly the book said, I will be on the Internet, ah, in the end, where is the difference? is the so-called listen to June words, Sheng Read ten years of book, today we come to talk about, why some people learned django various moves, but still do not do web development. If you think I'm right, welcome to the message below, if you think I'm wrong, then laugh at it as a joke.

In fact, the above problems, because some friends to Django and even the understanding of web development is not clear enough. Here I have listed five points, to correct some of the misunderstanding of everyone!

# # Myth One: Django database operation is simply to delete and change the search.

A lot of friends on the Internet to find some Django-related information after learning, you can use the Django ORM framework to achieve some data deletion and modification, I feel as if the key to open the door of the future, greatly pleased. I don't know, this is just the first step for a junior Django development engineer. If you want to use Django to make a decent website, you also need to learn more advanced technology. For example, "How to use ORM" to query the ID of the students who have not learned all the classes, the name of the "complex query", "How to improve the efficiency of database operations", "How to select the appropriate field type when defining the Model", "How to define a multilevel comment model", " The impact of Navie time and aware time on data access "and so on. These questions that you may not have thought of before, are in fact the norm in web development. If you don't know these techniques, how do you use the features that they now want?

# # Myth Two: Django template is the language is omnipotent.

Many students have learned DTL (Django template Language) data passing and rendering, thinking that the Django template language


As powerful as Python, you can do complex logic processing. But in fact, Django's template language ability is very limited, he does not have break and continue statements in the loop, in the latest Django2.0 can not even use the square brackets ([]) syntax to take the dictionary and the values in the list, not to use parentheses (()) to execute functions and so on. All this you think is very normal code, in the template is not supported! There is also a misunderstanding is that DTL can render Ajax asynchronously loaded data, DTL is only responsible for generating a template, the late modification of the page, DTL will be powerless. But it's not that you want to implement AJAX asynchronous loading without using DTL,DTL to implement "load more" functionality with other front-end templates such as Arttemplate.


# # Myth Three: Do not need to understand HttpRequest and HttpResponse objects.

HttpRequest and HttpResponse are two very important objects in the Django network processing process. Only the two objects have enough detailed understanding of the code can be written in the time to do so. For example, to determine whether the request is through an AJAX request we can judge by Request.is_ajax (), such as the need to implement anti-crawler technology, we can through the request. The key in meta to determine if the request was initiated by a crawler. In addition, including session processing, cookie data extraction, etc., are achieved through this object. While HttpResponse is not used directly, but we have been indirectly using it or his sub-class, For example, to return JSON data we do not need to json.dumps to HttpResponse, we can directly return a Jsonresponse object, such as want to implement a "file download" function, We should set the Content-disposition property in response's response header and tag the file name. Do you know all this?


# # Myth four: Using Django to develop a Web site without worrying about security issues.

## myth Five: Do Web development only need to learn Djan Go

This is one of the deepest misconceptions about Django. Many friends think that web development, as long as the learning of Django, you can develop a beautiful powerful website. In fact, a site is composed of front-end and back-end, the front-end is simply to display the page in the browser, need to html+css+javascript three sets of combined boxing to achieve. In addition to Django and the front end, some third-party features are also an essential element of the site. For example, SMS verification code to send, graphics verification code, mail sending, memcached cache optimization, paging technology, video encryption play, payment function, third-party login and so on. With these features, your site is a site for "people"!



These are just a few of the misconceptions we've made about Django or web development, because of the length of the page, and there are more technical details that can't be listed, such as "How to manage permissions," "When to use signals," "context processors and middleware," and so on.


Why do I learn django/flask, or do I not do web development?

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.