On Thu, Jul 8, 2010 at 5:23 PM, Bradley Hintze <bradle...@aggiemail.usu.edu> wrote: > I guess I just don't like the model.py, views.py, templates, and > url.py. In the tutorial you have to edit all of these and THEN you get > something that you can send to the client. It's very confusing! How do > they tie together? I probably need to do the tutorial again. It seems > to me getting info from the user should be strait foreword but its not > as displayed by the rather lengthy tutorial. But than I'm new to > this...
I think tutorial tries to show off django's features and how easy is to get a data-driven web app with few code. Anyway, django doesn't do any magic at all. You don't need models if you don't store the information in a database. You don't need use django's templates if you don't want. Usually, in your view _you_ tie together the model with the template and return a response which django pass to the user doing all the http stuff. Try this: """ file mytest.py """ # you require to return a HttpResponse instance in your view from django.http import HttpResponse # handler* are required for the urlresolver from django.conf.urls.defaults import patterns, handler404, handler500 # minimal settings DEBUG = True # tell django to use this file to find urlpatterns. see below ROOT_URLCONF = "mytest" # a basic callback to return something to the user. "view" in django's idiom def myview(request): # you can use html content if you want return HttpResponse("Boo!") # finally tie a url route to our view urlpatterns = patterns("", # the regex is used to match whatever after / # ^$ means "nothing", so route the url / to our callback "myview" (r"^$", myview), ) # /end That's all you need. Then run: (you are in linux?) $ PYTHONPATH=. django-admin.py runserver --settings=mytest PYTONPATH=. <- needed to tell python where to find our mytest.py --settings=mytest <- needed to tell django where to find the "project's settings" If you want learn and/or have more control over all the things and stay "close to the iron", you can try a micro-framework or go directly to wsgi. Search for: werkzeug, web.py, flask, etc Regards, ~Rolando -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.