Tuesday, December 27, 2005

Playing with Django -2

To setup the project folder, in command line, change directory to python-load-point\Django-0.90\django\bin, then type this command,

django-admin.py startproject myproject


This create a folder called "myproject" in the same location, inside this folder, there are sub-directory like below,



The first thing to do is, edit the settings.py file, with Notepad, or your Python Editor. Complete tutorial of course could be find in the Documentation, but some points are not for MySQL database, so what I did change are,

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = '
webpoll'
DATABASE_USER = '
root'
DATABASE_PASSWORD = '******' #password of my database


The next thing to do is to run the following command,

django-admin.py init --settings=myproject.settings


This is to declare to django-admin.py utility which setting we are following. However, a few trying, still get the same error message, as below,

C:\Python24\Django-0.90\django\bin>django-admin.py init --settings=myproject.set
tings
Error: The database couldn't be initialized.
Could not load database backend: No module named MySQLdb. Is your DATABASE_ENGIN
E setting (currently, 'mysql') spelled correctly? Available options are: 'ado_ms
sql', 'mysql', 'postgresql', 'sqlite3'

What I set in the Database_Engine section is 'mysql', somehow it keep telling me that there is no module name MySQLdb, and check whether I did spell 'mysql' correctly, available option are blah, blah, blah, and 'mysql'... no matter how many time I check it, they look exactly the same!! Hmmm... so I am kind of confuse now...

No comments: