Saturday, November 15, 2008

Practical Django Projects - Errata

Brett has good notes on how to get the examples to work. This a must if you are following the book. Otherwise it is pretty painful and I am sure you will give up.

coltrane entry_detail, there is a regex typo

Onto p61 ignore the class Admin, and then on p69 there is a typo in the regex. The last bit should be (?P[-\w]+)/$'

Check out complete list at:

http://blog.haydon.id.au/2008/08/4-django-powered-weblog.html

Friday, November 14, 2008

ImportError: cannot import name parse_lookup

Here is the solution to this problem:

1. instead of downloading the version of tagging use the one in svn
svn checkout http://django-tagging.googlecode.com/svn/trunk/ tagging-svn

2. either set the pythonpath or install

- cd tagging-svn
- sudo python setup.py install

This does the work.
coltrane, practical django projects book issues and errata

Monday, November 10, 2008

Day 1: Django - getting started - Django Tutorial

If you are on a linux system, check if you have python installed. Most probably it is.
shell> python
shell> .......
Download and install django and test it out

*********** Install Django ****************
wget http://www.djangoproject.com/download/1.0/tarball/
tar xvf Django-1.0.tar.gz
cd Django-1.0
sudo python setup.py install

*********** Test the install ***************
python
>>>> import django
>>>> django.VER
(1, 0, 'final')
>>>

************ Test to see if you have MySql installed ********************
1. Can you start and stop mysql on your system
sudo /etc/init.d/mysql start/stop

2. Initialize the grant tables
sudo mysql_install_db --user=mysql

3. Secure your mysql installation
mysql_secure_installation

4. log into mysql command line
mysql -u root -p

5. check users and set user passwords
select host,user from mysql.user;
set password 'xxxxxx'@'localhost'=password('dsfkjhdf');

6. check if you can log into mysql command line
mysql -u xxxxxx -p

****** create a new test site ****
1. django-admin.py startproject mysite
2. cd mysite
3. start django dev server
- python manage.py runserver
4. http://127.0.0.1:8000/

**** Installing mysqldb into python
python>>> import MySQLdb
---- if there is an error then install this

1. download libmysqldb python api from source forge
2. check if mysql_config is there in your system
3. if not do
apt-get install libmysqlclient15-dev
This will install the mysql_config tool.
4. python setup.py build
sudo python setup.py install

5. python>> import MySQLdb
-- no error successful