Created
July 8, 2010 23:08
-
-
Save rmax/468786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment