On Thu, 2006-05-18 at 00:03 -0700, Kosmo wrote:
> Well, if that is the case, is there a good tutorial on making views
> since I'm not so good with python yet.

Don't worry. They're not so hard. Just keep in mind that if you are
learning Django and Python simultaneously, you may have to backtrack
from time to time. But you can take small steps: set up urls.py to call
your view, write a view that does nothing but print "hello", modify the
view function to return a 404 page, modify the view function to do what
you want, etc. Testing each step will convince you that the right code
is being executed.

This would be a good place to start for views:
http://www.djangoproject.com/documentation/tutorial3/ (well, actually,
if you haven't read parts 1 and 2 of that tutorial, you go through them
as well, since part 3 builds on the first two).

> Also, if I want to have a view that is not tied to any app, how do I
> define it in the urls.py file?

You can put your views anywhere. The URLConf class is just given a
string that it tries to import as a python module (and then call the
last thing in the dotted path). Often this string is something like
'myapp.views.display'. But it could just as easily be
'some_other_dir.some_file.display' (which would try to import
some_other_dir.some_file and then call display() in that module).

There is nothing special about where your views are located, except that
they should be importable from your project.

Cheers,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to