[Solved]-Django or yii for building a production web app with db and with custom forms and reports


I know this is old but I feel like I can add to this, having used both frameworks.

Yii is a solid, fast framework. It isn’t quite as secure out of the box as Django due to certain things (cross-site request forgery protection, for example) not being enabled or enforced by default. For me the single biggest advantage was the built-in code generator, because once you figure it out and start using it, it basically spits out a full-featured CRUD application in minutes.

Django is my framework of choice, because Python is Django’s single biggest advantage. Not busting on PHP, I actually really like the language, but Python’s clean object-oriented-ness (that a word?), class inheritance, etc. really shines with a framework like Django. There is no built-in code generator in Django, which was a deliberate choice by the developers. That is both a strength and a weakness. Yii’s code generator can become a bit of a crutch if you’re really trying to learn the framework, but with Django, once you learn how it works, you can go in and change anything, because you built it yourself, and it forces you to learn the framework well. With Yii, when you have your generated code and have to do a customization, THEN you may quickly begin fighting the framework.

Django’s ORM is highly flexible, I’m a SQL guy myself and I think I’ve used raw SQL in my applications exactly once. Yii’s is pretty good but I give Django a leg up in this regard as well, and Django’s is extremely well documented.

Installation of Yii is slightly easier than Django, in my experience. Django takes a bit more work to get up and running. Django’s tutorial is much, much stronger than that of Yii, at least it was when I started.


My suggestion would be Django. Forms in Django are classes, and of all the frameworks I’ve worked in over the past 16 years, from classic ASP to .NET, Rails and Java, I’d put Django’s way of doing forms up against any of them.

South makes it ridiculously simple to do schema and data migrations.

I would recommend using Postgres over MySQL, especially if you’re going to be leveraging Django ORM, as it’s a bit more fine-tuned for Postgres. If you don’t need Django admin and you have to use MySQL, you might take a look at SQLAlchemy and Alembic.

Django’s learning curve is very flat. It’s incredibly easy to learn and is extremely well documented.

My $0.02.


Yii is superb. I could learn it and get going within a couple of hours. I struggled to setup Django because of confusing configuration and URL mapping that is needed to get anything working. I have no doubt Django is excellent once you learn it but in my experience Yii was a lot easier to learn.

I really wish someone would port Yii to python.


Leave a comment