Nvim

Nvim

Django vs Phoenix

Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help.

  • Where are they similar?
  • Where do they differ the most?
  • When would you use/recommend either?
  • Anything else you’d like to share?

Most Liked

mikemccall

mikemccall

Based on my current experiences here is my take. I don’t have a comprehensive guide, but beyond handling web request and mostly following mvc they are not all that similar. Django has models and an ORM phoenix uses schemas with Ecto. Django’s use of “apps” fall in line with using contexts but each django app has it own mvc file structure. Which I have to admit I like. Django is also bloated with features and can serve a very wide range of web projects out of the box. It comes with a ready to go admin. Phoenix is explicit while django is implicit. I applaud both Phoenix/Elixir and Django for the excellent documentation.

Both communities are generally pleasant. Phoenix doesn’t take on user land solutions. For example authentication/authorization. Phoenix leaves the decision up to you, while django comes with it (including password upgrading). The elixir phoenix community hasn’t quite caught up with some of the other popular django apps such as Wagtail and saelor. But it will.

That being said django does not even come close to providing the ease of use when working with realtime. The phoenix team has done an amazing job adding realtime capabilities (my biggest pull to phoenix). With phoenix you also get the benefits with running on the beam. Phoenix has liveview which is very nice. I’ve already seen community members of django, crystal, and laravel implement their own versions. But those will not be as scalable.

Overall my default is elixir/phoenix. It’s fast and enjoyable. There are more than enough community packages to rival django. While “user land” decisions are not made for you by the framework itself, the community has fantastic libraries. The elixir community is full of some really smart experienced people. Pow is a good example of this. The elixir community is very happy to guide you in the right direction. You will not only learn and become a better developer, but you will start to realize those framework abstractions aren’t as hard as they might seem.

All that said, phoenix is probably closer to Flask than Django.

If a client needs cms capabilities, e-commerce or they really can’t be sold on elixir I go with django. Otherwise, elixir and phoenix all the way! Hope that helps.

28
Post #4
dimitarvp

dimitarvp

You already were given excellent answers. My really short version is this:

Do you want to have most of what you need ready-made and able to be put in your project with small initial friction? Go for Django.

Do you want to build part of the required functionality (like authorization and CMS) yourself, while retaining full control on what is going on below the hood? Go for Phoenix.


Have in mind though: apps made with implicit/magic frameworks always come with a high maintenance burden. They allow you to start quicker but you pay off those savings in the future, many times over. A lot of Rails and Django apps are an example of this phenomena.

woeye

woeye

I’ve been working with Django since version 0.9x. So for quite some time now.

There are several things I really like about Django:

  • Excellent documentation. All in one place, nice tutorials, nice examples.
  • Many useful features included, like Sitemap generation, CORS, authentication & authorization, etc
  • A very powerful admin interface which is most often good enough for basic administration tasks

The downside is that concurrency related tasks are very hard to do and requires workarounds like job-queues etc.

Especially the concurrency issues are what brought me to Elixir. And so far I am pretty happy with Elixir/Phoenix. For me the most noteable differences where:

  • The documentation in the Elixir world feels cluttered. Like, lots of packages and you have to jump between packages all the time. Even worse I often wondered why the documentation doesn’t mention feature X until I figured out that I had to look at package X by myself. Take ecto and ecto.migrations for example.
  • Phoenix does a really bad job in terms of self marketing imho. Compare the Django site and then Phoenix. I feel Django does a much better job at explaining why Django is great, getting started tutorials, highlighting its features, etc. In that regard Phoenix indeed feels more like Flask.
  • I feel that Ecto is a bit more low-level compared to Django’s ORM. But I actually like this because it allows me to better facilitate PostgreSQL’s features.
  • The directory layout in Phoenix still feels weird to me, like the difference between :app and :app_web. I rather prefer Django’s app approach, which are fully contained including views, templates, url mappings, etc.
  • One thing I really miss from Django is the admin feature. In countless projects it was a huge time saver.

Where Next?

Popular in Discussions Top

pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
WolfDan
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19204 150
New
AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
jsonify
So, is Heroku the only free option for hosting Phoenix/Elixir at this point? I’m not ready to commit to paying monthly and was wondering ...
New

Other popular topics Top

TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement