2011年5月3日 星期二

create first main_page

1.modify urls.py add new line
urlpatterns = patterns( '',
# Examples:
# url(r'^$', 'django_bookmarks.views.home', name='home'),
# url(r'^django_bookmarks/', include('django_bookmarks.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
url( r'^admin/', include( admin.site.urls ) ),
url( r'^$', main_page ),
)

2.add new content on views.py

from django.http import HttpResponse
def main_page( request ):
output = '''
<html>
<head><title>%s</title></head>
<body>
<h1>%s</h1><p>%s</p>
</body>
</html>''' % ( 'Django Bookmarks', 'welcome to use django', 'nice to meet you' )
return HttpResponse( output )

沒有留言:

張貼留言