The advantages and disadvantages of Django that people with one year of experience think

What kind of framework is Django in the first place?

I think Django is a difficult framework that, to my touch, is different from Rails or Express. Personally, I think it's ** a little big Express + a lot of batteries **

Why do you think so

This is because the framework itself is simpler than Rails and has a ** battery ** that allows you to create a wealth of convenient websites.

merit

Simple configuration

Rails has app, config and various files, while Django usually has only the following files

With this configuration, there is a problem that the views become long, but since you can use the means of dividing or writing only the logic to another code, there is no problem unexpectedly.

Abundant batteries

--Automatically generated Admin page (where data can be managed) --CRUD forms can be created easily

You can easily create CRUD forms

It will be long if you write various things, so I will fold it, but for example, you can create a new user only with the following

views.py


from django.contrib.auth.forms import UserCreationForm
from django.views.generic.edit import CreateView
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User

    
class CreateUser(CreateView):
    model = User
    form_class = UserCreationForm
    template_name = "user.html"

    def get_success_url(self):
        return reverse('index')

~~ import is long because it is a Python specification, so please give up ~~ From this code, you can derive the following features of Django:

--User model is automatically generated in the first place --It's relatively easy to create a new model

Besides, it is easy because it uses decent encryption technology as standard, so there is no need to know the encryption technology.

Sober and wide coverage

As I wrote in other articles, it also supports streaming distribution, so in theory it can also support SSE.

Demerit

Relatively legacy

By default, Sass, Babel, and TypeScript cannot be used, and the process of making them available is quite troublesome.

There is little information in Japanese

Since there are few examples of use in Japan, you will be reading English as a matter of course. Besides, it is difficult for Japanese people to exchange information, and there are few jobs.

Not so fast

It's a full-stack framework, so it can't be helped, but it doesn't have that much speed advantage over other frameworks.

CSRF Token is annoying

If you use Ajax, it will be blocked if you do not pass the CSRF Token, the problem is that it is sober

How to cover the disadvantages

--Using Django REST Framework, throw all front ends to Node --Learn English --If the logic part is the bottleneck, throw it to PyPy ――I feel reassured that it is secure

Finally

I hope anyone wants to try Django in this article. Also, the range that can be analyzed with my arm is about this, so if anyone can supplement it, please do not hesitate to contact me.

Recommended Posts

The advantages and disadvantages of Django that people with one year of experience think
Advantages and disadvantages of maximum likelihood estimation
This and that of the inclusion notation.
The story of making a web application that records extensive reading with Django
One liner that lists the colors of matplotlib
Here is one of the apps with "artificial intelligence" that I was interested in.
I just wanted to extract the data of the desired date and time with Django
Learn Nim with Python (from the beginning of the year).
Visualize the range of interpolation and extrapolation with python
Think about the next generation of Rack and WSGI
Predict the number of people infected with COVID-19 with Prophet
[Django 2.2] Sort and get the value of the relation destination
The story that Japanese output was confused with Django
Extract the maximum value with pandas and change that value
Script that changes the length of the sound with REAPER
Let's introduce the library currently used by engineers with about 3 years of experience in Django
Save the output of GAN one by one ~ With the implementation of GAN by PyTorch ~
See the power of speeding up with NumPy and SciPy
One liner that randomly rewrites the startup time of cron
Until the start of the django tutorial with pycharm on Windows
Let's visualize the number of people infected with coronavirus with matplotlib
Play with the password mechanism of GitHub Webhook and Python
For the time being, the one who creates a homepage with Django at the speed of a second and publishes it on Heroku (Windows compatible)