Django Development Environment Configuration on Mac OSX
You may need to keep XCode open while installing Homebrew to accept the agreement.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew install python --with-brewed-openssl
Download and install from http://dev.mysql.com/downloads/mysql/
brew install postgresql
To make it auto start on login, you have to run
ln -sfv /usr/local/Cellar/postgresql/9.3.2/*.plist ~/Library/LaunchAgents
Download and install PGAdmin from
http://www.pgadmin.org/
Start postgreSQL server
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop postgreSQL server
pg_ctl -D /usr/local/var/postgres stop -s -m fast
Update login method in
vim /usr/local/var/postgres/pg_hba.conf
Create lib link, need to mkdir the /usr/local/opt/postgresql/lib/ folder first
ln /usr/local/Cellar/postgresql/9.3.2/lib/libpq.5.6.dylib /usr/local/opt/postgresql/lib/libpq.5.6.dylib
pip install virtualenv
vim ~/.bashrc
with content
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache
create .bash_profile
vim ~/.bash_profile
with following contents
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin/:/usr/local/Cellar/postgresql/9.3.2/bin/:$PATH"
export PATH
[[ -s ~/.bashrc ]] && source ~/.bashrc
reload bash environment
. ~/.bash_profile
Add the following to ~./bashrc
syspip(){
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
If in the future we want to upgrade our global packages, the above function enables us to do so via:
syspip install --upgrade pip setuptools virtualenv
mkdir ~/Projects
cd ~/Projects
virtualenv test
cd test
activate it
. bin/activate
just type deactivate
to deactivate current envrionment
create file pip_packages with following content
distribute
Django
MySQL-python
PIL
django-compressor
python-memcached
pyOpenSSL
boto
requests
humanize
psycopg2
install packages
pip install -r pip_packages
Download from http://dev.mysql.com/downloads/tools/workbench/
sudo gem install cocoapods