Django and Python / Laravel Development

Django vs Laravel 8

As for most such comparisons much depends on what you need the frameworks for. Essentially they both are MVC, keeping in mind that MTV (Model Template View) for Django means in fact Model View Controller. That is – in Django View you keep controller logic, and Template is basically where you design how your interface looks like. Actually, there are many similarities in both frameworks, except Django uses Python and Laravel uses PHP.

Which framework is better? Quick answer – both frameworks are very good, so which one you use depends on your project. At start Django has some advantage having a nice and very helpful admin module, with superuser, which helps much in development. The only problem is that unique field for users is based on username instead on user email, BUT this can be quickly fixed with installation of a free package all-auth which customises user logic.

Laravel 8 provides user auth scaffolding module JetStream, which has nice features like two factor authentication, but basically it provides what it should: out of the box you can have user authentication with password recovery, email verification and few other essential addons.

The problem with Laravel is, that it uses a kind of business dependency injection. For instance, they promote Tailwind CSS, and made it default CSS option for pagination. Fortunately, as for version 8 you can change it to Bootstrap 4. Is Tailwind CSS much better than Bootstrap? No. Is Bootstrap much better than Tailwind CSS? No. But, Tailwind CSS is a commercial project, where they offer some stuff for sale, so probably this way Laravel business can make more money. It means however, that maybe from Laravel version 9  you will HAVE TO USE Tailwind CSS, which will be painful.

In development Django seems to be more “clean”, so to speak, and its logic where it “forces” you to split functional parts of a project into separate apps, with separate templates, routing and views inside the apps, seems to simplify development. Using apps for functional / business logic parts of a project gives you quick insight what is where and how it works. Also, communication of model with controller/view/business logic – all this is much simpler due to Django data types. Yes, you can do similar things with Laravel, but with Django you get it out of the box.

Big advantage of Django is the fact that you can easily use/integrate Python libraries, so probably for advanced scientific/statistical projects it would be better option. Also,

Laravel 8 can be installed on LAMP environment without rather big problems, so as long as there is Linux machine, with PHP installed, some server like Apache or Nginx and MySQL database you can get your project quickly working. However, keep in mind, that on many shared web hostings you cannot use all Laravel options/possibilities – there are always some limitations. So, my advice if you want to save money is – use Laravel on local environment as much as possible and for production go with VPS or AWS or hostings recommended on Laravel site.

For commercial projects, for both frameworks, you have to use AWS, VPS hosting or cloud server. Django has some advantage here thanks to Python Anywhere hosting. On Python Anywhere you can get cheap environment to work with advanced Django projects, without messing with AWS EC2 setup. Finally, for serious commercial projects probably you will need AWS anyway.