views:

219

answers:

3

I'm still a complete beginner in the field of web development and I'm trying to set up the Django environment. I'm reading "the definitive guide to django" to start my practice.

I'm running Snow Leopard (10.6.2) on a macbook 2.1GHz. It came with Python 2.6.1. Since Snow Leopard cam with Python 2.6.1 preinstalled, so I didn't do any extra set up. Maybe it needs more setup, please let me know. But I've ran it, and it works.

I installed django straight right from the book. I've ran it, and so far it works.

The Database configuration is the one stifling me.

I tried installing MySQL with MySQLdb module for python, but it had complications with the difference between 32 & 64 bit architecture (either mysql had 64 and python had 32 OR vice versa; Either way, I couldn't figure it out). I've read many forums and tinkered with it for hours, still couldn't fix it and I just gave up.

So I tried the next best thing (or so I thought), Let's try to set up Postgre instead. So, I went to the official Postgre website and picked the Mac OS X installment package. I download it, extract it, and all it had was an ".app" installer and a "README". I ran the installer, blah blah blah, I followed the instruction, it did this, it did that. At the end, apparently Postgre is installed.

I didn't feel completely sure if it was installed, so I searched around the internet for some answers. Well, I found the official documentation for installing Django for Mac, but the steps to install Postgre was completely different. Maybe the ".app" installer did most of the configuration listed in those steps, I don't know.

Then I went to the terminal and type in:

psql -V

(to check which version of Postgre I just installed)

AND

sudo -u postgres pg_ctl start

(to run the database)

'psql' or 'pg_ctl' commands could not be found. To me, this is kind of saying Postgre was not installed or there are some setup I still need to do.

So I started looking at the first steps of installing Postgre from the given instruction by Django (link above). From the instruction it says to edit the '~/.profile', even after unhiding all the files and directories, I still can't find it under my user directory.

At this point I'm just kind of frustrated and don't know where to go. I was wondering if I can get some direction/tips/howto/anythingreallyatthispoint.

I can't really install psycopg2 until I have Postgre running, but from the looks of it, it doesn't look so bad to install it (or so I hope).

Many Many thanks in advance for any help ^_^

-Tri

+1  A: 

the easiest way to install these apps would be via macports (http://www.macports.org/). in my experience, the installation was fast and clean. the geodjango installation documentation has a good section on this: http://geodjango.org/docs/install.html#macports.

Carson
Thanks. I think I'll try this next time.
Tri
+1  A: 

If you're just getting started, I would try sqlite first. It's file based, so there is almost no configuration. Later, if you want to upgrade to a real database, then it won't be any harder than what you're attempting now.

Chase Seibert
Good tip, thanks! It didn't help me with my Postgre problem, but it helped me with my database problem, good enough! Also SQLite3 already came with the OS, so that made things so much easier.
Tri
A: 

I suspect the only problem you are having is not setting path. Add this to your ~/.bash_profile:

export PATH=/Library/PostgreSQL/8.4/bin:$PATH

Now you should be able to run the command line tools like psql.

Van Gale
but "~/.bash_profile" does not exist in my local directory
Tri
thats fine. you can create it and insert the line above, assuming that is where PG is installed.
Carson
Exactly. I made the assumption on path because I just installed postgres last week from the official mac install, so versions should match exactly.
Van Gale