There are a few different options that are often mentioned regarding Django and eCommerce services. I could have rolled my own but I’m trying to get better about giving previously built and tested libraries more of a chance before doing so.

After some research, I decided to give Satchmo a try for a shopping cart front. While I did come across some newer projects like Satchless, I wanted to see what the most popular one was up to. Satchmo was the most talked about and came up the most in conversations so I decided to dive in. The Quick Start guide got me most of the way there but I did hit a couple of hiccups that I thought I’d share with everyone.

First off, make sure you run everything in sudo.

My first step I didn’t read that Mercurial had to be installed. So if you miss that and get something like:

randomdrake:~$ sudo pip install -e hg+
Obtaining satchmo from hg+
  Cloning hg to ./src/satchmo
Cannot find command 'hg'
Storing complete log in /home/randomdrake/.pip/pip.log

Just run:

sudo apt-get install mercurial

Once I got things installed, I wanted to dive right in and start configuring things. With the project cloned, I fired up the server with a python runserver and hopped over to I was a bit disappointed to see that the text input box doesn’t properly fit on the default index page. Maybe that should be fixed somewhere?

But, no matter. I wasn’t after the design, I wanted the structure to build on top of. After clicking around for a bit, I thought it would be easy to find the template files and start to understand how the default page is done. Turns out I was a bit wrong. I started to browse through the source that gets installed by default for you. You can find it here:


After digging around for a little while and doing some finds, I decided to ask the Googles and see what I could come up with. Fortunately I found a little note in the Wiki that explained where I could start looking with a bit more clarity. So, to get rolling I hopped in the base.html file that is located here:


I simply copied this file into my local application’s /store/templates/shop/ directory and I was able to start hacking around on the layout.

Now that I had direct access to modifying the default template, I wanted to get it running in PostgreSQL. We can see, by default, it is setup to run in a SQLite database by looking in our /project/store/ file:

    'default': {
        # The last part of ENGINE is 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'ado_mssql'.
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(DIRNAME, 'simple.db'),  # Or path to database file if using sqlite3
        #'USER': '',             # Not used with sqlite3.
        #'PASSWORD': '',         # Not used with sqlite3.
        'HOST': '',             # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',             # Set to empty string for default. Not used with sqlite3.

After creating a new database and database user on my local machine, I simply filled the the values and ran the following:

python syncdb

A quick visit to my local host and I could see everything was working splendidly. I didn’t have any of the sample data to get in the way and I could simply start going through and creating my site completely from scratch. Just what I was looking for.

Hopefully you found this guide helpful to getting you up and running with Satchmo. If you liked this post, please follow me @randomdrake or consider following my feed.


The documentation from Heroku on how to start and deploy a Django application is quite excellent. Unfortunately, there’s not a lot of information out there on how to deploy something you’ve already written. In addition, the guide assumes you already have a decent amount of knowledge surrounding things like virtualenv. Because of this, I thought I’d go ahead and document the process this time instead of just angrily Tweeting about the problems and misunderstandings. Please feel free to comment any additional problems, or nuances you run into regarding doing this on Ubuntu.

First thing’s first, installing the Heroku toolbelt. While the simple command they give you seems pretty straightforward, there’s a small problem. They mention the following:

“The heroku command line client will be installed into /usr/local/heroku and /usr/local/heroku/bin will be added to your PATH.”

That’s all good except they don’t actually add it your $PATH for you. They add it to your ~/.bashrc file:

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

Because of this, you’ll need to restart your terminal or add it manually before you can easily complete the Heroku login instructions.

Alright, let’s go ahead and get logged in:

randomdrake:~$ heroku login
Enter your Heroku credentials.
Password (typing will be hidden): 
Authentication successful.

Excellent, we’re logged in. Now it’s time to let Heroku know what we need installed to run our app. The first thing that the Heroku guide instructs you through is creating your necessary requirements.txt file. One can do this by running the following command:

randomdrake:~$ pip freeze > requirements.txt

Unfortunately, just performing this outright in your Ubuntu environment produces an unnecessarily large requirements.txt

randomdrake:~$ cat requirements.txt

Because of this, we need to create a virtualenv to nail down our requirements. If you don’t have virtualenv, yet. You can get it get it through either of the following commands:

randomdrake:~$ sudo apt-get install python-virtualenv 


randomdrake:~$ sudo pip install virtualenv

Now that we have virutalenv installed, we can go about starting it up, installing our requirements, and getting an accurate requirements.txt. When I’m doing this step, I like to go to my file in my app to look and see what’s installed under INSTALLED_APPS. It will probably look something like this:

    # Uncomment the next line to enable the admin:
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',

This gives us an idea of what we’re going to need to install in our virtual environment. Let’s get started creating our virutal environment and installing those requirements. Go ahead and cd into the root of the directory where your app lives. From there, we want to follow the Heroku documentation:

randomdrake:~/myapp$ virtualenv venv --distribute
New python executable in venv/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
randomdrake:~/myapp$ source venv/bin/activate
(venv)randomdrake:~/myapp$ pip install Django psycopg2 dj-database-url
Downloading/unpacking Django
  Downloading Django-1.4.1.tar.gz (7.7Mb): 7.7Mb downloaded
  Running egg_info for package Django
Downloading/unpacking psycopg2
  Downloading psycopg2-2.4.5.tar.gz (719Kb): 719Kb downloaded
  Running egg_info for package psycopg2
    no previously-included directories found matching 'doc/src/_build'
Downloading/unpacking dj-database-url
  Downloading dj-database-url-0.2.1.tar.gz
  Running egg_info for package dj-database-url
Installing collected packages: Django, psycopg2, dj-database-url
  Running install for Django
    changing mode of build/scripts-2.7/ from 664 to 775
    changing mode of /home/randomdrake/myapp/venv/bin/ to 775
  Running install for psycopg2
    building 'psycopg2._psycopg' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090106 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/usr/include/python2.7 -I. -I/usr/include/postgresql -I/usr/include/postgresql/9.1/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement
    no previously-included directories found matching 'doc/src/_build'
  Running install for dj-database-url
Successfully installed Django psycopg2 dj-database-url
Cleaning up...

If you are familiar with the additional packages you need to install from your INSTALLED_APPS listing, go ahead and install them now. To see if you have successfully installed everything, try to run your server:

(venv)randomdrake:~/myapp$ python runserver
Error: No module named taggit

We can see that we are missing the taggit module. So we’ll go ahead and install that too.

(venv)randomdrake:~/myapp$ pip install django-taggit
Downloading/unpacking django-taggit
  Downloading django-taggit-0.9.3.tar.gz
  Running egg_info for package django-taggit
Installing collected packages: django-taggit
  Running install for django-taggit
Successfully installed django-taggit
Cleaning up...

Keep on doing this until you can successfully run your server:

(venv)randomdrake:~/myapp$ python runserver
Validating models...

0 errors found
Django version 1.4.1, using settings 'myapp.settings'
Development server is running at
Quit the server with CONTROL-C.

Now that we know we can run our server, we can freeze our requirements:

(venv)randomdrake:~/myapp$ pip freeze > requirements.txt

Take a look and see that we now have a nice, succinct list of requirements that we need for our particular app:

(venv)randomdrake:~/myapp$ cat requirements.txt 

You can feel free to leave your virtual environment now by issuing the deactivate command. You can also go ahead and remove the ./venv directory that was created with a little rm -rf venv action.

Before we go ahead and create our Heroku app, let’s let it know we want to use a different WSGI than the default. For some reason, they don’t document the process until after you’ve gotten your app up and running which, is a bit odd, considering it’s widely suggested to use an alternate. Follow the directions in the guide regarding “Using a Different WSGI Server” to setup gunicorn.

I personally like to setup a few gunicorn workers. So, I add a Procfile in the application root with the following:

web: gunicorn exampleapp.wsgi -b$PORT -w 10

This will ensure your Heroku installation has a few workers available to accept requests. Now we can go ahead and create our Heroku app! Hopefully you’ve already got your source code in a github repo. If not, get your own repo setup with your code first as you won’t be able to access your code as it’s committed to the Heroku repo. Now let’s follow the directions from the Heroku guide:

randomdrake:~/myapp$ heroku create
Creating tranquil-tundra-8486... done, stack is cedar |
randomdrake:~/myapp$ git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Well crap, that didn’t work quite as smoothly as expected. This is because Heroku isn’t recognized as a remote repository. You can see the remote repositories you have setup already:

randomdrake:~/myapp$ git remote -v
origin (fetch)
origin (push)

As one can plainly see, Heroku is not one of the ones listed there. No worries, we can add it as a remote option. When we did the heroku create command we were assigned a random app name. In our example: neat-narfy-4242. We can use this to add our correct remote heroku host:

randomdrake:~/myapp$ git remote add heroku

Now we can try our push again:

randomdrake:~/myapp$ git push heroku master
The authenticity of host ' (' can't be established.
RSA key fingerprint is 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ',' (RSA) to the list of known hosts.

At this point, you may get an error like:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

If this is the case, it means you haven’t added your public key to Heroku, yet. Assuming you have already generated your keys for your system in your home directory, you can add your key with a simple command:

randomdrake:~/myapp$ heroku keys:add ~/.ssh/

Now you should be able to succcessfully deploy your app following the remaining instructions in the guide.

I hope that helped out. If you have additional issues doing this in Ubuntu 12.04, or just want to leave a message, feel free to comment below.

If you liked this post, consider subscribing to my feed or following me on Twitter at @randomdrake.

Geekery, Life, Programming

My routine in the morning is simple:

  • Wake around 7:00am.
  • Kiss my wife.
  • Stretch.
  • Feed the cat.
  • Go outside to welcome the day from my view on this little rock in the ocean.
  • Check Hacker News.
  • Shower.
  • Put the kettle on.
  • Water my veggie and herb garden.
  • Make my coffee with the AeroPress.
  • Kiss my wife.
  • Meditate, and/or do the dishes.
  • Ready myself for work.
  • Kiss my wife and tell her I love her.
  • Go to work.
My backyard view.

I like my routine; it works for me. I was never a morning person for most of my life. I was always the one who stayed up late and slept in until the afternoon. I was a night owl; bartender. Late night MMORPG player. Programmer and hacker. The night time was my right time.

Something changed within the last year or so. I don’t know what it was, but things are different now. The day greets me and I am always eager to return the gesture. Maybe I’m just getting older. I am turning 30 in two weeks. I have lots of thoughts and feelings around this. Changes, milestones, and goals are suddenly becoming important to me in ways I never thought possible.

Upon checking Hacker News this morning, a story struck me with joy. The Commodore 64 was turning 30.

I have the logo for the Commodore 64 tattooed, prominently, on my left shoulder. It has been a huge part of defining who I am, as a person, and where my life has taken me. I shared a story with the Hacker News community, in the comments thread, that I feel deserves repeating here, on my blog.

Here goes:

Commodore Logo

I’ve got the logo for the Commodore 64 tattooed on my left shoulder. It began my love of computers at a young age that has been with me for my entire life. I turn 30 in 2 weeks. I feel glad and honored to share a birthday so close to something that has affected my life so much. It’s fun to know we grew up together.

I’d like to share a story with Hacker News about something so dear to my heart.

When I was just shy of 3 years old, my father brought home some greyish-brown television-looking thing. He had purchased it from a co-worker of his, along with a bunch of games on floppy disks and cartridges, a joystick, and a KoalaPad. He turned on the computer, some sounds happened, and a blue screen eventually appeared with a flashing prompt and the word “Ready.”

He fussed through some manuals and papers to find the boot sequence necessary to start something called Jumpman. I watched, in fascination, as he was able to manipulate these things on the screen. Various beeps and boops emitted from the machine and a little stick figure climbed ladders and dodged various objects. He quickly died in the game.

He started to show me other stuff this thing was capable of. KoalaPainter was absolutely wonderful. I could draw and manipulate shapes on the screen as much as I wanted; as if I was using a piece of paper.

He couldn’t get me away from the thing. Eventually, bedtime came around, and I cried as I was torn away from something that I was completely enamored with.

Around 2 or 3 in the morning, my father awoke, hearing weird noises coming from the basement. He groggily stumbled down the stairs and into the room to find his 3 year old son, covered with a blinking glow, sitting at the keyboard. After watching him perform the boot sequence only a couple of times, I had it memorized, had gotten up from my bed, and was sitting there playing games.

Silent Service. Kickman. Heist. These kicked off a long and wonderful obsession with technology, computers and video gaming. They defined who I would be as a child; a self-professed, proud nerd and geek. Dungeons and Dragons, Magic the Gathering; the whole nine yards. 286, 386, 486. Oak Technologies. Math co-processors. Sound Blaster. Voodoo. Serial cable LAN parties playing Doom. Betrayal at Krondor. Ultima VI. BBS. MUD. The first time I saw a GIF. Links. The Nintendo Entertainment System.

So many absolutely wonderful memories that I wouldn’t trade for anything. The Commodore 64 was absolutely integral in defining who I have been and who I continue to be. Without it: I have no idea where I’d be in this world.

I’m a software developer now. I’ve been programming since I was in grade school. I picked up a software application development degree just because I thought it may be handy someday. I grabbed a theatre degree, because it was my other passion I discovered at a relatively young age.

Computers have always been in my life, through thick and thin. They always do exactly what you tell them to do. Nothing more, nothing less. Humble machines that push electrons around to provide entertainment, fascination, communication and now, connection.

Thanks Commodore. I owe you one. Happy birthday.

Happy Birthday Commodore 64 Cake

If you liked this post, please consider following me @randomdrake or subscribing to my feed.