Django's Weirdness

Hi folks!

I haven't written in a long time, especially not something technical so here are some notes on weird parts of Django.

Views

Rails is following MVC. Good ol' MVC. When I started dabbling around Django I know they're doing the same.

I did an ls in the root of the project and it turns out there is nothing named a "controller". That really got me. I was completely confused and was not sure where can I find something like a controller. For sure, it must not be the views folder? Well joke on me, it's right there. :)

After a bit of googling it made sense, but it was not making any sense at the start. Here is a SC link that explains what's going on.

Nested Routes

I think nested routes can be awesome in Rails if you don't go more then 3 layers in depth. It makes routes look clear, restful and helps separate the concerns. I have not found anything similar in django.

There are a few libraries that are trying to do this, but they did work that well for me.

Too DRY

One can write a view with five lines of code. Now while that is awesome to look at for the first time, I don't really like the fact that everything is hidden.

In Rails you have to write actions you want to support. I often find myself forgetting how to do something in Djangos view because it's all abstracted.

Conclusion

Definitely not an expert in Django, and some of the things listed above are likely due to not being experienced in this framework. But it definitely took some time to get used to and to figure out a way around certain things.

Nikola Novakovic

Software engineer that loves business side of things as well. Also lifts a lot of weights.

Subscribe to get regular updates