Jess
Jess

Reputation: 1849

Problems setting up a postgreSQL database for a django project

I'm new to Python/Django so forgive me if this is a simple problem to solve...

I'm trying to set up a PostgreSQL database for my Django project. I have downloaded PostgreSQL 9.2 from here http://www.postgresql.org/download/macosx/ and gone through the installation process. I've been following a wiki article which said to update my system path to /Library/PostgreSQL/9.2/bin, which I have. When I type 'nano ~/.bash_profile' into Terminal I see this 'PATH ='Library/PostgreSQL/9.2/bin' which I believe means I have updated my system path correctly. However, when I then try to run the command 'createdb', I see this...

-bash: createdb: command not found

I believe I have installed PostgreSQL correctly so I'm not sure how to get around this.

Any help would be very much appreciated!

Thank you

Jess

Upvotes: 1

Views: 2108

Answers (2)

TheDeveloper
TheDeveloper

Reputation: 422

PATH ='Library/PostgreSQL/9.2/bin is overwriting your global $PATH with just the PostgreSQL binaries. It should be the following instead:

PATH="$PATH:/Library/PostgreSQL/9.2/bin"

This appends the PostgreSQL bin directory to your $PATH, instead of overwriting it. Don't forget to start a new terminal session after you make the edit, or do the following in your current session:

source ~/.bash_profile

In general, the best way to install open source software, packages and utilities on OSX is to use homebrew. Homebrew is a package manager for OSX to simplify the installation and management of programs such as PostgreSQL, and many other popular open source projects. Check it out!

Upvotes: 2

David S
David S

Reputation: 13841

While it's not exactly an answer to your "question", it might solve the problem for you. Have you checked out the PostgreSQL "app"? It's created by Matt Thompson & supported by Heroku Postgres and is meant to make PostgreSQL development easier for people using Mac. You might want to give it a look. Here's a link. Or just google "Postgresapp".

Upvotes: 0

Related Questions