Thursday, January 12, 2006

Django -0.91 SyntaxError!!

As I scroll through this blog today, I have notice there is a comment for my last post. It has been a long long time since there is any comment in my blog. And suprise, suprise, it is *the* creator of Django, Adrian Holovaty. Wow, how could he notice about my blog?? I am really thrilled.

Anyhow, I did do the standard python setup.py install command, then I got this error message when I try to install Django-0.91,

CONFLICT WARNING:

The following modules or packages have the same names as modules or
packages being installed, and will be *before* the installed packages in
Python's search path. You MUST remove all of the relevant files and
directories before you will be able to use the package(s) you are
installing:

c:\python24\lib\site-packages\django

(Note: you can run EasyInstall on 'Django' with the
--delete-conflicting option to attempt deletion of the above files
and/or directories.)
-------------------------------------------------------------------------
creating c:\python24\lib\site-packages\Django-0.91-py2.4.egg
Extracting Django-0.91-py2.4.egg to c:\python24\lib\site-packages
Removing django 0.90 from easy-install.pth file
Adding Django 0.91 to easy-install.pth file
Installing django-admin.py script to C:\Python24\Scripts

Installed c:\python24\lib\site-packages\django-0.91-py2.4.egg
Processing dependencies for Django==0.91


Guess that is due to the old c:\python24\lib\site-packages\django structure created by django-0.90. So I have remove the "django" folder and try the install again. This time it run without an error. So I suppose that work this time around.

And so I proceed with the tutorial, much like previous tutorial, only easier, as now we have manage.py to take care of most of the thing. And we get to see django in action quite early in the tutorial by connecting to http://127.0.0.1:8000, that is actually a nice touch. As we went along with the tutorial, at some stage it really make us think, am I lost? Am I following the right path here? Letting the user see django web server in action actually play a big 'comforting' role. :-)

Just as I thought that I would sail along smothly to, at least complete the second tutorial, then I stuck at the "Start the development server" section. After doing all the activating admin site steps as according to the tutorial:- add 'django.contrib.admin' to INSTALLED_APPS', run python manage.py install admin, uncomment a lin in the urls.py, etc, a long list of error appear when I try to connect to http://127.0.0.1:8000/admin/.

SyntaxError at /admin/
invalid syntax (urls.py, line 4)
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/
Exception Type: SyntaxError
Exception Value: invalid syntax (urls.py, line 4)
Exception Location: c:\python24\lib\site-packages\django-0.91-py2.4.egg\django\core\urlresolvers.py in _get_urlconf_module, line 87


There are actually more lines (a lot more lines!!) of errors follow, just to save the space of this post, I just put in the first few lines here. As I browse through the tutorial, comments, as well as the django google group, it seems like no other people facing this problem. This must be something wrong with my setting or maybe it is just plain bad luck?

I really wish Adrian is still reading this blog. Adrian, could you please advice me on this?

btw, thanks for dropping by. And care to share how you come accross my blog?

3 comments:

Adrian Holovaty said...

Looks like there's a typo in your urls.py file. For more information, run the command "python urls.py", and it should give you a more descriptive traceback describing the syntax error. If you paste it here, I'd be happy to take a look!

Bruce said...

I'm certainly not Adrain, but I found your site via http://icerocket.com

kahfei said...

Hi Bruce,

I did a search on technorati and IceRocket for "django", it end up with easily hundreds of result, so this is just a bit shocking for me Adrian is dropping a comment on my blog.