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

vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
mikl
I wanted to capitalize a string, and tried using String.capitalize(). That generally works well, until you try to capitalize a word like...
New
sashaafm
I’m trying to evaluate the best combo/stack for a BEAM Web app. Right now I’m exploring Yaws a bit, after having dealt with Phoenix for a...
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
ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
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
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
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 127536 1222
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement