Live data from Hacker News

Thoughts about Rails from a Django guy

lenni.info

31–40 of 42 posts

Re: Thoughts about Rails from a Django guy

#31
post #24

Earlier quoted context omitted.

As somebody who has used both Rails and Django commercially I can safely say that I prefer Rails over Django even though I like Python more as a language. This guy marks several advantages of Rails as weaknesses. Migrations for example. In Django you have to migrate manually, or lose data. Lack of migrations is not an advantage. Templates. The Django template language is one of the worst in existence. It is utterly i…

> As somebody who has used both Rails and Django commercially ... In Django you have to migrate manually, or lose data If you've been using Django "commercially", then how come you haven't heard of South? ... http://south.aeracode.org/ Everybody in the community that wants migrations is using it. > Why not go all the way to a usable and powerful template language?! In Django components are more decoupled than in Rail…

It's kind of odd that the default subsystems that come with Django are always replaced with something else -- why doesn't Django include some sane defaults instead?

Re: Thoughts about Rails from a Django guy

#32

Interesting. Both are great frameworks. My thoughts are: I like how django lacks all that directory structure and you can easily use a single file for your models. Django templates are way more powerful and safer than erb / haml, etc. I wish there was a port of django templates in ruby. If so my preferred environment would be sinatra + datamapper + django templates.

http://ruty.rubyforge.org/

Ruty hasn't really been maintained, but it is pretty close to Django's templating system. Apparently, there's even been a little work to get it together with Sinatra (http://github.com/eladmeidar/sinatra-mvc/blob/master/app/hel...). I haven't used Sinatra, but I have played with Ruty and it's pretty nice and supports things like Django-style inheritance. It's a pity it never took off and this isn't a complete answer to your desire, but it might be an interesting place to look around.

Re: Thoughts about Rails from a Django guy

#33

Interesting. Both are great frameworks. My thoughts are: I like how django lacks all that directory structure and you can easily use a single file for your models. Django templates are way more powerful and safer than erb / haml, etc. I wish there was a port of django templates in ruby. If so my preferred environment would be sinatra + datamapper + django templates.

http://ruty.rubyforge.org/ Ruty hasn't really been maintained, but it is pretty close to Django's templating system. Apparently, there's even been a little work to get it together with Sinatra ( http://github.com/eladmeidar/sinatra-mvc/blob/master/app/hel... ). I haven't used Sinatra, but I have played with Ruty and it's pretty nice and supports things like Django-style inheritance. It's a pity it never took off and…

oh very cool thanks for the link.

Re: Thoughts about Rails from a Django guy

#34

>migrations: I can see how this could come in handy but in my case this was yet another extra thing I had to keep tabs of I only use django and have never-not used migrations for a project. Thanks god for South. http://south.aeracode.org/

I'm confused. South is all about migrations...

"South brings migrations to Django applications." -http://south.aeracode.org/docs/about.html

Re: Thoughts about Rails from a Django guy

#35
post #30
post #25

Earlier quoted context omitted.

I agree this was frustrating initially. After a certain number of django projects most of the django devs I know use the heck out of it's modularity. If the templating system is driving you insane drop in Jinja2 and go. If it just needs to be tweaked then implement the template command yourself. I felt confined and frustrated with Django until I realized that it was built with the intention that developers should jus…

Shouldn't the included templating system be the one everyone uses? It doesn't make sense to include a templating system if everyone will eventually just replace it with something better. Even though there are alternative rails templating systems out there, I would say a good 80% of the projects out there use the default "erb" mechanism for templates -- it's simple, it's ruby, and it works. Capitalization or minor str…

Shouldn't the included templating system be the one everyone uses?

Agreed. I think they know that this is a weakness. I'd expect it to improve over time. In a similar fashion to them addressing ifequal and ifnotequal in 1.2.

Capitalization or minor string manipulation in erb doesn't require one to write a template filter function somewhere else.

Personally I'd prefer defining it once somewhere. Then use the function everywhere. Even with the initial code cost.

I think this is from past bad experiences. I once "repaired" a million plus line of code enterprise app that had misused some open source code that did date and number coercion (similar to django.contrib.humanize but for ASP). Needless to say the code was a mess and nearly the same code had been mixed in all over the place. The template code, the backend business logic and the asp C# files. After a few days of regexing then testing then fixing then searching then repeating. And then dealing with all the edge and special cases - I'll take a simple defined template function. All that being said - my example is a gnarly enterprise example involving bad code monkeys. So take it with a grain of salt - it's likely that the story isn't applicable to a lot of people here. But still - lesson learned. In the future designers can request template improvements and I'll deliver.

Re: Thoughts about Rails from a Django guy

#36

Interesting. Both are great frameworks. My thoughts are: I like how django lacks all that directory structure and you can easily use a single file for your models. Django templates are way more powerful and safer than erb / haml, etc. I wish there was a port of django templates in ruby. If so my preferred environment would be sinatra + datamapper + django templates.

There's also mustache (http://github.com/defunkt/mustache) which has some similarities to django templates and is pretty popular.

"safer than erb / haml, etc"

Are you are referring to auto-escaping strings? If so, in Rails 3, this is on by default, and for Haml without Rails it's a simple setting.

Re: Thoughts about Rails from a Django guy

#37
post #24

Earlier quoted context omitted.

As somebody who has used both Rails and Django commercially I can safely say that I prefer Rails over Django even though I like Python more as a language. This guy marks several advantages of Rails as weaknesses. Migrations for example. In Django you have to migrate manually, or lose data. Lack of migrations is not an advantage. Templates. The Django template language is one of the worst in existence. It is utterly i…

> As somebody who has used both Rails and Django commercially ... In Django you have to migrate manually, or lose data If you've been using Django "commercially", then how come you haven't heard of South? ... http://south.aeracode.org/ Everybody in the community that wants migrations is using it. > Why not go all the way to a usable and powerful template language?! In Django components are more decoupled than in Rail…

[deleted]

Re: Thoughts about Rails from a Django guy

#38
post #35
post #30

Earlier quoted context omitted.

Shouldn't the included templating system be the one everyone uses? It doesn't make sense to include a templating system if everyone will eventually just replace it with something better. Even though there are alternative rails templating systems out there, I would say a good 80% of the projects out there use the default "erb" mechanism for templates -- it's simple, it's ruby, and it works. Capitalization or minor str…

Shouldn't the included templating system be the one everyone uses? Agreed. I think they know that this is a weakness. I'd expect it to improve over time. In a similar fashion to them addressing ifequal and ifnotequal in 1.2. Capitalization or minor string manipulation in erb doesn't require one to write a template filter function somewhere else. Personally I'd prefer defining it once somewhere. Then use the function…

Well, anyone can still write crap code with Django, it doesn't require an enterprise C# language to produce crap. Django templates still have logic that needs to be tested & debugged so the template filter functions don't alleviate all the pain either. Plus, the concept of template filter functions is available in pretty much all web frameworks out there, but it's more painful to use if the templating language forces one to write a filter function every time you need to wield the python language.

Re: Thoughts about Rails from a Django guy

#39
post #9

I subscribe to the view that the template language is for designers and should only allow safe constructs. As someone who does both design and programming, I hate template systems that do this with a passion. I don't want to have to learn another language just so I can write templates. Especially when that language makes me jump through hoops to do various simple tasks the designers didn't anticipate--which is the ca…

I think there are two valid approaches here, depending on the project. One project I'm currently involved with has a team of content/design people who work on Django templates - giving them more power with a template engine like Jinja2 or Mako would introduce nightmares.

On the other hand, when I'm building my own applications the Django template engine seems ridiculously bureaucratic, when I just want to drop in a Python function without reams of template tag boilerplate. That's one of the main reasons why I prefer Flask/Jinja2 for my side-projects (well that, and SQLAlchemy).

Re: Thoughts about Rails from a Django guy

#40
post #31

Earlier quoted context omitted.

> As somebody who has used both Rails and Django commercially ... In Django you have to migrate manually, or lose data If you've been using Django "commercially", then how come you haven't heard of South? ... http://south.aeracode.org/ Everybody in the community that wants migrations is using it. > Why not go all the way to a usable and powerful template language?! In Django components are more decoupled than in Rail…

It's kind of odd that the default subsystems that come with Django are always replaced with something else -- why doesn't Django include some sane defaults instead?

This implies that Rails has "sane defaults".

From my experience that's hardly the case ... ActiveRecord (pre 3.0 at least) sucks big monkey balls compared to Django's ORM. And Rails also doesn't have anything like the forms API in Django.

Post reply on HN