Skip to content
November 25, 2011 / ecschroder

Got a mac =)

Got a mac! Life just got better. Thank you Jacob, for the deal & for the protips. Going through some set up stuff now. Things on my mind:

Set up virtual environments

Say you need to use Python 2.6 for one project; Python 3.1 for another. Each time you switched between projects, you would need to switch back and forth between Python installations. Instead of changing your default PYTHONPATH settings back and forth, you can work within a virtual environment.

First, install the virtualenv package. (Great instructions here.) Then use these commands to create and workon virtual environments.

mkvirtualenv --no-site-packages [name of virtualenv]

…creates a new virtual environment, but doesn’t copy everything else that’s in the root.

workon [name of virtualenv]

…lets you work within a certain virtual environment.

(test_environ)Emmas-iMac%

…reminds you that you’re in a virtual environment.

Connect to GitHub

Create a new SSH key and connect it your GitHub account. Instructions here.

Get homebrew

Get homebrew and use it to install packages. Stuff that’s not Python, I mean. Don’t use homebrew to install Python. It will screw with your life. (Homebrew will always grab the latest version of everything, and you don’t want that for Python.)

Install PIL

In my Trash or Treasure project, each item in the database has an image. When I try to add a new item through the admin interface, I get this message:

Upload a valid image. The file you uploaded was either not an image or a corrupted image.

It seems that Django can automatically handle PNG images, but can’t do anything with JPG or GIF unless it has its sidekick PIL (Python Imaging Library). This is where Mac ownership is going to pay off. I seem to remember an afternoon wasted installing PIL on Windows. On Mac, I’m guessing it’s just:

brew install pil

It works. OMG that is so easy. [Note to self: need to install packages in each virtual environment, or once for good?]

Managing shared files

Most of my project files are on GitHub, so sharing is all set. But assets and images won’t live in the code repo, so I need another way to share them between computers. Dropbox is super easy…winning. Just need to copy over a few static files and…that’s it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: