Thứ Hai, 29 tháng 7, 2013

Django Tutorial 1. Setup

1. Install pip

1.1 Download easy_install https://pypi.python.org/pypi/setuptools
1.2 Install easy_install
$python setup build
$python setup install
$easy_install pip

1.2 Install Django

$pip install Django==1.7


1.3  Trường hợp dùng mysql

$brew install gcc48
$pip instal mysql-python

chú ý:
1. Nếu xảy ra lỗi error: my_config.h: No such file or directory
Thì nguyên nhân là do chưa cài gcc

2. Do bản Mysql dùng chung với MAMP k được buil kem với gcc nên phải cái mysql riêng. Dùng câu lệnh bên dưới.
$brew install mysql

Để khởi động mysql.
 $sudo /usr/local/mysql/support-files/mysql.server start

1.4 Trường hợp dùng MongoDB


http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/

Install  MONGODB
pip install https://bitbucket.org/wkornewald/django-nonrel/get/tip.tar.gz
pip install https://bitbucket.org/wkornewald/djangotoolbox/get/tip.tar.gz
pip install https://github.com/django-nonrel/mongodb-engine/tarball/master
1.4.1 Start MongoDB
$mongod: Khởi động server  = mysql.server start
$mongo: accesss = mysql -uroot

1.4 Install Eclipse PyDev

http://pydev.org/manual_101_install.html

1 nhận xét:

  1. good guide (y)

    But in 1.3, have to use

    sudo apt-get install libmysqlclient-dev

    instead of brew..... if using Ubuntu :v

    Trả lờiXóa