Django – get database configuration name in multi database settings

I’m very new in Python and Django programming. Recently I was writing a migration script to copy data across databases. Each database was in different machine and I’ve all the configurations in settings.py under different label like ‘default’, ‘staging’, ‘production’ etc.

While the migration was working almost fine, I was getting an error like the following during saving associated objects.

ValueError: Cannot assign "": instance is on database "staging", value is on database "default"

Continue reading →

Amistad – Facebook like friendship management in Ruby on Rails

Today I’ve decided to write something about the Ruby Gems that I used. So I’ve started this series (Ruby Gems). This is the first post of the series. I will try to write regularly.

When I was working on my pet project MovieMates, I needed to implement a friend relationship. Initially, I was going to do it myself. However, later I thought I should, at least, google a bit to check if there is already some similar solutions. Then I found Amistad.

The current version of Amistad supports ActiveRecord 3.0.x, Mongoid 3.0.x and MongoMapper 0.12.0.

Installations

Add following line to your Gemfile

gem 'amistad'

Continue reading →