Sunday, January 08, 2006

Playing with Django - 5

After a few days rest(playing with Newsvine, and as of now, I am the current "Most voted Stories" in the sport section", haha), continue with my Django adventure, after creating the table, there are a few commands you could type in to get more info, according to the tutorial,

  • sqlinitialdata polls -- Outputs the initial-data inserts required for Django's admin framework.
  • sqlclear polls -- Outputs the necessary DROP TABLE statements for this app, according to which tables already exist in your database (if any).
  • sqlindexes polls -- Outputs the CREATE INDEX statements for this app.
  • sqlall polls -- A combination of 'sql' and 'sqlinitialdata'.

But I just wanna get the thing done as soon as possible, so go straightaway type in this command, install polls

What this will do is "take the output of sqlall polls and execute it in the database pointed-to by your Django settings file." Wao! I don't really know what it means, hmm... That is really too deep for me, so just get on with it.

Next step is to start a Python IDE, type,
from django.models.polls import polls, choices

But another horror traceback error pop up,

Traceback (most recent call last):
File "", line 1, in ?
File "c:\python24\lib\site-packages\Django-0.90-py2.4.egg\django\models\", line 1, in ?
from django.core import meta
File "c:\python24\lib\site-packages\Django-0.90-py2.4.egg\django\core\meta\", line 1, in ?
from django.conf import settings
File "c:\python24\lib\site-packages\Django-0.90-py2.4.egg\django\conf\", line 29, in ?
except KeyError:
EnvironmentError: Environment variable DJANGO_SETTINGS_MODULE is undefined.

Oh oh, that is bad. I try to set again the DJANGO_SETTINGS_MODULE before start the Python IDE to run the same command, well, same errors. Even go as far as create a new project, then a new apps, still stuck at the same point.

This is really getting frustrated now.

No comments: