As I write, I’m a backend team lead for a Singaporean startup that develop an e-commerce platform. We decide to use Django REST Framework over NodeJS as backend application for CRUD operations of models from the front-end side (mobile app).
Listed below are some of the reasons why Django REST Framework wins over NodeJS:
-
- Easily define models/classes and use of inheritance
class User(AbstractBaseUser, PermissionsMixin): created = models.DateTimeField(default=timezone.now) email = models.EmailField(unique=True, db_index=True) username = models.CharField(max_length=50, unique=True, blank=False) first_name = models.CharField(max_length=100, blank=False) last_name = models.CharField(max_length=100, blank=False) USERNAME_FIELD = 'username' REQUIRED_FIELDS = ['email', 'first_name', 'last_name'] class Meta: verbose_name = 'user' verbose_name_plural = 'users' db_table = 'users'
Very fast prototyping, isn’t it?
- Systematic and neat API URLs configuration
Unless you develop a very small app, you can manage the API URLs easily by importing each app module URL configuration file into the main app URL configuration file - Easy database models/tables migration
You modify a model and Django will create a migration file to alter your database table structure - Many packages available
Thousands of available modules or packages at https://pypi.python.org/pypi to shorten your time to develop software - Use of Python
Python is an easy-to-learn programming language. For example:
# Print Fibonacci numbers less than 10:>>> # Fibonacci series: ... # the sum of two elements defines the next ... a, b = 0, 1 >>> while b < 10: ... print(b) ... a, b = b, a+b
- Easily define models/classes and use of inheritance
There are some other advantages, you'll find out when you use it 🙂 .