Posts in 'tech' – Page 3

"Setting up a Django Server with Gentoo"

This is part 3 in a 3 part series I've written on setting up a Django production site on Gentoo. In the first 2 parts I went over basic boilerplate server setup, and database installation which can be on the same server or separated.


"RESTful Django"

I've been taking a lot of time lately to determine a best practice way of incorporating a RESTful approach to Django views. My goal is to come up with a solution so simple, using a third party library won't be necessary.

As a first step, I've borrowed ...

"Installing MongoDB with MacPorts on MountainLion"

Technically this should be as simple as:

sudo port install mongodb

Unfortunately, the mongodb port depends (for now) on devel/boost <= 1.49. The boost port was recently upgraded to 1.50, so to install db you will have to uninstall boost and explicitly reinstall it at version 1.49 ...

""ractivate", the Missing Script for RVM"

When developing multiple projects in Ruby using RVM, I've found that it can be difficult to keep track of which binaries and gemsets you are using, and installing gems to the wrong gemsets can cause problems. Inspired by virtualenv, I've created (largely copied) a script to switch between ...

"Virtual Hosting, Rails, NGINX, Apache, Passenger, Ubuntu"

I've become a fan of RVM, which allows you to create pseudo virtual environments called "gemsets" that can be version-locked to the specific needs of your individual projects. In Rails, deploying several of these projects to a single server can be tricky. This tutorial describes how this can be ...

"Installing Ruby on Mountain Lion/MacPorts"

If you use MacPorts, the following should get Ruby installed and working on your machine.

Install RVM

Taken from the RVM website:

curl -L | bash -s stable --ruby

Install OpenSSL and libyaml

sudo port install openssl libyaml

(Re)Install Ruby

rvm reinstall 1.9.3 --with-openssl-dir ...

"Rails 'through' vs Django 'ManyToMany'"

Ok, Rails & company have a lot of great points--I love RSpec--but I've noticed a few areas where Rails can improve. Here, namely, I see a big difference in handling multiple relationships to self.

In Rails


class CreateRelationships < ActiveRecord::Migration
    def change
        create_table :relationships do |t ...

"Why RoR is Awesome (part 1 of many)"

I finally took the plunge. I'm learning Rails. And holy shit.

RoR has a philosophy of being RESTful, which means using what's already built (HTTP) rather than reinventing the wheel.

I launched a "users" app using just these three commands taken from the tutorial I'm following:

rails ...

"Testing Management Commands"

I think to be a good Django citizen it would be appropriate to write tests ensuring that standard management commands work with your application. I thought of this after dealing with a certain app that doesn't handle loaddata very well.

Going forward, I'm adding this TestCase to all ...

"Django Model Managers via Related"

It is fairly common practice to use a custom model manager when you have a certain field(s) that you know you will be filtering by a lot. I found a small caveat from the traditional approach when you take related objects into account. Take this classic example for published ...