Coding / Programming Videos

Post your favorite coding videos and share them with others!

Django? Why isn’t PHP just? – RIffadi Taufik Hidayah – Medium

Source link

For those of you who want to know Django, it can be assumed that you already have a basic experience making websites using other languages ​​such as PHP, isn’t that right?

Because in truth, a framework like Django requires a little skill above the beginner. For example, if you use PHP you can insert the program code into an HTML file, while in Django you have to separate the program logic from the HTML file.

In addition, the cost after creating a website is also greater than PHP. If you use PHP, then you can find cheap shared hosting that can run your PHP-based website. Unlike the case with Django-based websites, which currently (2019) require at least VPS because there is no shared hosting for Django-based websites.

If it’s more busily than PHP, why use Django?

For those of you who already have website development experience, of course you have experienced the process of writing code repeatedly. This is the most tiring thing in a website development process.

For example, you create website A with a login feature, two months later, you create website B which also requires a login feature.

If you use pure PHP without a framework, of course you have to write code that handles the login process repeatedly for each different website.

Django invites users to focus on the function of a website that will be built by them, while tiring parts such as writing code that is repeatedly taken over by Django to facilitate the work of a programmer.

In other words, Django will provide the login feature. While you as a web programmer simply focus on other programming logic that is more important.

Ok We Need Framework. Why do you need Django?

Django is one of the most promising modern web frameworks in the future, some large sites like Instagram, Disqus, Pinterest, Bit Bucket, even though NASA uses Django on their servers. Django is a website creation framework for the Python programming language.

Python itself is currently (2018) a language with a more rapid increase in users and even beating PHP which is still popular in Indonesia.

Why? Because Python is very multifunctional. In addition to website development, you can also use Python language to create artificial intelligence (machine learning, deep learning), data analysis, computer vision, Internet of Thing, etc.

What is the Difference between Django vs. PHP Framework?

If you have used other website development frameworks such as Laravel, Symfony, etc. Of course you are no stranger to the term MVC (Model-View-Controller). Where you separate the data storage logic, data presentation logic, and logic for displaying data.

Not much different from other frameworks, Django has an MVT pattern (Model-View-Template).

In short, the Controller in another framework is replaced with the file urls.py or commonly called the url routing. While Viewing on other frameworks is replaced with Templates on Django. The template in Django, besides being able to produce a web page like HTML, can also be used to generate JSON, XML, CSV, etc.

The model here is that data to be stored, used, processed by Django which is stored in a database. While View is a protocol or procedure written by programmers for Django in response to user requests.

MVC, Framework, Ribet? Why Don’t Just Use Pure PHP?

If you have built a web application before, maybe you have gone through these classic steps. Here are the classic stages experienced by a web developer.

  1. Write a web application from 0
  2. Realizing that the first application turned out to have the same functions as the second application. (Example login feature)
  3. Factoring the programming code in both applications so that both applications can run normally with the same code in some of their functions.
  4. Repeat steps 2–4 several times.
  5. In the end you realize that what you make is not just a website application, but a website framework!

The steps mentioned above are steps taken by the previous Django creator.

Many web developers are not aware that they spend more time creating websites because they rewrite code that could have been written once and then used repeatedly for several different websites.

How did Django make history?

Django was born in a Lawrence Journal World — Kansas news agency, which was created because of the real needs of a super busy news agency.

Adrian Holovaty and Simon Willison are programmers who created Django for the news agency in Python. The making of Django is that it has a very busy schedule. From its history, we can see that Django has several advantages, namely Django is present and used by managers of super busy websites that deal with databases and dynamic content, that’s why Django is suitable for content-based websites like ebay, craiglist and washingtonpost.com.

Just Brief, What Are the Advantages of Django?

The thing that I personally think makes Django superior to other Python frameworks is that Django has provided everything so it’s ready to use. Starting from database management using ORM (Object Relational Mapping), user management, etc.

Besides that Django is safer because by default it prevents security gaps like XSS, CSRF, SQL Injection etc. That said, even though Django is harder to learn for beginners than PHP, Django is safer and can accelerate the development of more complex websites.

And because Django is based on the daily experience of website programmers for news agencies, the Django framework almost every day gets updated features aimed at creating a framework that is faster, more resistant to high user surges, and easier to maintain a website.

Conclusion

It can be concluded that Django is a solution created to speed up the process of creating super busy websites, namely a news website where Django was first used.

Because the speed at which a website is created sometimes forgets security gaps that are prone to attacks, the Django framework has been equipped with several features to strengthen the security of a website.

Some large sites like Disqus and Instagram are proof of Django’s resilience in handling requests millions of times per day.

If you need more references please go to the official Django site.

This is only an introduction, one of several stories to get acquainted with Django. Then look forward to the next story.

Source link

Bookmark(0)
 

Leave a Reply

Please Login to comment
  Subscribe  
Notify of
Translate »