How to use django model outside of django framework?

Which framework is better to use to tightly integrate an Adobe Flex front end with Facebook, Ruby on Rails or Django?

  • I'm trying to choose between RoR and Django for the back end of a web app that integrates heavily with Facebook and has a Flex 4 front end. I'm new to both frameworks (and the languages - I'm from a mostly C/C++ background), so familiarity with either is not a factor. I'm also discarding some of the commonly quoted considerations, such as popularity, support, documentation, performance, scalability, aesthetic preferences, etc. - both frameworks seem more than capable for most purposes with the right architecture. The three aspects of the frameworks that I researched for a while, but couldn't quite reach a verdict on are the following: Facebook SDK: I came across python-sdk for Python and facebooker2/mogli for Ruby. They seem to be what I need, but I was under the impression that the facebooker2/mogli gems don't get as much support as the python-sdk. Are both SDK's equally capable of complex interactions with FB's graph api? Is there anything else better out there that I've missed? Hosting: I don't want to spend a lot of time being a sysadmin, so I'd prefer a service that provides a higher level of abstraction. Ruby has Heroku and EngineYard, both of which seem to be excellent. For Django, I found quite a bunch, both most of them started yesterday and it's not clear whether they'll be around tomorrow... WebFaction seems to be the leader, even though it doesn't seem as simple as the Ruby alternatives. Google App Engine has restrictions that bug me (like BigTable). One thing that started popping up recently is that Heroku now supports python. Is that true??? I even saw some examples, but there is nothing official on the Heroku site. Anybody know what the deal is? I sent them a question, still waiting for the answer. Interaction with Flex: Python has pyamf and Ruby has rubyamf, but rubyamf seems to be falling behind (not working with Flex 4, Rails 3). If I go with Ruby, am I left to my own devices here? I'd appreciate any comments, thoughts, answers to the questions above. If you can validate some of my conclusions, point out alternatives that I have missed, or dispel any misconceptions that have crept into my open source n00b mind, I'd be very grateful!

  • Answer:

    I'm going to go with Rails on this one.  Disclaimer: I swing towards the Ruby side of the Ruby/Python spectrum. I've actually built a Flex Facebook game with a Rails 3 backend.  From experience, here's what I found: Facebook SDK Ruby has several mature libraries for interacting with the FB API.  I recommend fbgraph and facebooker2, both of which work with Rails 3, Ruby 1.9+, and work flawlessly.  These libraries are mature, in use by large apps, and are battle tested.  You can get more detail here: Hosting I've set up enough servers for Rails hosting in my day to know I never want to do it again.  Heroku is absolutely incredible for that very reason.  If you use Ruby + Heroku, you won't have to think twice about hosting.  Seriously. Interaction w/ Flex Here's where you I ran into problems.  I used the RubyAMF library and found it hard to work with for several reasons: Tightly coupled to Rails.  It broke in unintuitive ways when used with ActiveRecord.  To even use it at all, I had to dig into the library and rewrite parts of it. Buggy.  On more complex objects, it just didn't work.  It would bork both serializing and unserializing AMF objects. Too much magic. That being said, there's hope.  I would take a look at Warhammerkid's Rails3AMF plugin (https://github.com/warhammerkid/rails3-amf).  Once you get it working, it's works really well. Overall, use Ruby because: There are more libraries available The libraries are older, more mature, and better supported Heroku is amazing

TJ Murphy at Quora Visit the source

Was this solution helpful to you?

Other answers

Facebook SDK: Facebook has discontinued support for the Python SDK (see http://bugs.developers.facebook.net/show_bug.cgi?id=17429). But you should look at pyFaceGraph, it's pretty neat. Hosting: There's no mature company like Heroku specifically aimed at Django yet, but i have tried http://gondor.io and http://ep.io and they both look very promising (see here for a good list from Jacob Kaplan Moss: ). Heroku runs Python on their new Celadon Cedar platform. I have used Google App Engine previously, and although not fully compatible with Django, they've really put out some really cool services on their platform lately, like the Pipeline API. If you want to go with Appengine Django nonrel is trying to bridge the NoSQL-SQL divide (http://www.allbuttonspressed.com/projects/django-nonrel), also you can check out this video http://blip.tv/pycon-us-videos-2009-2010-2011/pycon-2011-running-django-apps-on-google-app-engine-4899514. Now if only App Engine had SSL for custom domains. UPDATE 12/23/2011: So development has been ceased on django non-rel but Google has since released a traditional SQL database for App Engine. Also, I've settled on using http://Ep.io a lot for small projects. It isn't perfect but I think it's very handy and stable for small deployments. Interaction with Flex: I have used pyamf, albeit a few years back, and it worked well for me. You might want to look at Tastypie (https://github.com/toastdriven/django-tastypie) if you're going to build API on top of Django for Flex.

Guðbergur Geir Erlendsson

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.