Archive for April, 2008

Configuring MySQL-Python on OSX Leopard

Sunday, April 27th, 2008

At WebSight Design we try to remain technology-agnostic. (The right tool or language for the job.) Having said that, we are primarily a PHP shop. However, with the launch of the Google App Engine, we’ve been looking seriously at Python. In recent years, I have become a big fan of development frameworks so to aide me in learning the ways of the snake, I have been using the Django framework.

Getting it all setup wasn’t difficult. The Django installation is very easy. I started to get errors when I was trying to get my models working when I ran

manage.py syncdb

. Come to find out that I needed the MySQL-Python library installed to work correctly on my OSX Leopard machine. Most everything that I illustrate below is to be executed from the command-line. So if you are not familiar with working in the Terminal app, this post is gonna suck for you. So here is what I did to get it working:

First, download MySQL for Python
http://sourceforge.net/projects/mysql-python
for me it was MySQL-python-1.2.2.tar

Unpack it:

tar -xzf MySQL-python-1.2.2.tar

Change to the directory that is created:

cd MySQL-python-1.2.2

Next, locate your “mysql_conf” file.

locate mysql_conf

Copy the location of this file so you can use it in the next few steps.

Next, you need to edit the “site.cfg” file and add the path to your “mysql_conf” file.

mysql_config = "YOUR_PATH_GOES_HERE"

Also, (very important), change the line that reads:

threadsafe = True

TO

threadsafe = False

Save and exit the file.

Now, compile and install the library:

python setup.py build
sudo python setup.py install

NOTE: You may need to run “python setup.py clean” if you previously tried to build and install the library.

Next is the *really* important part. After I kept getting errors trying to run the Python server I found the missing piece on the ProjectMouse.org site.

The key is, you need to create a symbolic link in the location that Python is expecting to find MySQL. This should be a link to the MySQL library that your computer is setup to use.
See here:

sudo mkdir /usr/local/mysql/lib/mysql/
sudo ln -s /usr/local/mysql-5.0.41-osx10.4-i686/lib/libmysqlclient_r.15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.15.dylib

NOTE: “mysql-5.0.41-osx10.4-i686″ is where MySQL is installed on my machine. Change this to the location specific to your computer.

Finally, import MySQLdb into Python and test your configuration:

python
import MySQLdb

NOTE: You should not see any errors or warnings. Hit “Ctrl+d” to exit the interepter.

Now go back and run

manage.py syncdb

again and you should not get any errors.

Usability: Know Your Target Audience

Friday, April 11th, 2008

When it comes to design, the web has another dimension that design for print doesn’t: usability. Visitors to a web site need to know where to click, and how to find what they want, all while being actively engaged in the visual experience that represents the company, person, or people the web site is for. Instead of just opening a brochure and seeing the words on the paper, web site users interact with a site, enlarging photos, expanding menus, highlighting links, and leading animations. Because of this, designing for the web requires a continual focus on usability.

The best indicator of successful usability is a clear understanding of the web site’s target audience. For example, the audience of our rock musician clients want multimedia. They want to download audio tracks, play videos, see large photos, and actively participate in the web experience on a fan level. A fan will most likely have multimedia plugins on his or her computer, and if not, will eagerly download them to be able to access enhanced content.

The audience of our real estate clients, however, want to find information, and find it quickly. They aren’t interested in lingering through a Flash animation that stands as a hurdle to the information they’re after. And while photos of properties are necessary, waiting for them to load, having to navigate a sea of thumbnails, or having too-small images will turn a potential homebuyer into a frustrated web user. The real estate agent or company won’t get that user’s phone call.

The tough part is finding the balance between easily giving base-line visitors what they want, and not boring (therefore, alienating) more sophisticated web users. Luckily, that just happens to be our specialty. With design that’s focused on both visual impact and usability, WebSight Design creates a custom-tailored user experience, based on your target audience.