sábado, 5 de fevereiro de 2011

Django on Mac OS X 10.6.6 cookbook

System - Sistema:
  • Mac OS X Version 10.6.6 - Snow Leopard
  • Python 2.6.1 - default
Extras:
Tiker Tool
To show the hidden mac files at finder and others functionalities

Install MySQL:
 $ curl -O http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.5/mysql-5.5.8-osx10.6-x86_64.dmg  
 $ sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server  

Locate the configuration defining the basedir and set the following :
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
Creating and configuring MySQL to Django:
 $ /usr/local/mysql/bin/mysql -u root  
 CREATE DATABASE django CHARACTER SET utf8 COLLATE utf8_general_ci;  
 GRANT ALL PRIVILEGES ON django.* TO 'django'@'localhost' IDENTIFIED BY '<password>';  


XCode:
Download and install XConde for GCC and others

MySQLdb:
provides the Python bindings to interface with the database.

 $ curl -O http://internap.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz  
 $ tar -xvzf MySQL-python-1.2.3.tar.gz  
 $ cd MySQL-python-1.2.3  

Edit the site.cfg file:
Uncomment the line that begins #mysql_config =

Edit the path to point to /usr/local/mysql/bin/mysql_config:

mysql_config = /usr/local/mysql/bin/mysql_config
Complete the build and installation:
 $ python setup.py build  
 $ sudo python setup.py install  
 $ cd ..
  

IPython - optional
 $ curl -O http://ipython.scipy.org/dist/ipython-0.10.1.tar.gz  
 $ tar -xvzf ipython-0.10.1.tar.gz  
 $ cd ipython-0.10.1  
 $ python setup.py build  
 $ sudo python setup.py install  
 $ sudo python setup.py install_scripts --install-dir=/usr/local/bin  
 $ cd ..  

Install Django:
Exemplo where place django source code:

 $ cd ~  
 $ mkdir django  
 $ cd django  
 $ mkdir src  
 $ cd src  

Unpacking and installing:
 $ tar xzvf Django-1.2.4.tar.gz  
 $ cd Django-1.2.4  
 $ sudo python setup.py install  

Last MySQLdb fix:
 $ export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/  

Last Python Path fix:
 $ export PYTHONPATH=<pasta onde baixou o django>  
 Ex.:  
 $ export PYTHONPATH=/Users/dev/django/src  

Nenhum comentário:

Postar um comentário