Views and URLconfs(The Definitive Guild to Django)
2010-03-25 20:31
441 查看
urls.py 1 from django.conf.urls.defaults import *
2 from mysite.views import hello, abc, hours_ahead
3
4 # Uncomment the next two lines to enable the admin:
5 # from django.contrib import admin
6 # admin.autodiscover()
7
8 urlpatterns = patterns('',
9 ('^hello/$', hello),
('^time/$', abc),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
# Example:
# (r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
2 from mysite.views import hello, abc, hours_ahead
3
4 # Uncomment the next two lines to enable the admin:
5 # from django.contrib import admin
6 # admin.autodiscover()
7
8 urlpatterns = patterns('',
9 ('^hello/$', hello),
('^time/$', abc),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
# Example:
# (r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
相关文章推荐
- Advanced Views and URLconfs(The Definitive Guild to Django)
- The Definitive Guide To Django 2 学习笔记(一) Views and UrL confsRL
- Sessions, Users, and Registration(The Definitive Guild to Django)
- Generic Views(The Definitive Guild to Django)
- Caching(The Definitive Guild to Django)
- Templates(The Definitive Guild to Django)
- The Django Admin Site(The Definitive Guild to Django)
- Forms(The Definitive Guild to Django)
- The Definitive Guide To Django 2 学习笔记(三) URLconfs 和松耦合
- Introduction to Django(The Definitive Guild to Django)
- Models(The Definitive Guild to Django)
- Advanced Models(The Definitive Guild to Django)
- Deploying Django(The Definitive Guild to Django)
- Advanced Templates(The Definitive Guild to Django)
- Generating Non-HTML Content(The Definitive Guild to Django)
- Getting Started(The Definitive Guild to Django)
- The servlets named [X] and [Y] are both mapped to the url-pattern [/Z] which is not permitted
- django提交表单报错"You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SL
- IE title changes to <afterHash> if the page has a url with '#' , and has flash/swf embedded in it
- The Definitive Guide To Django 2 学习笔记(九) 第五章 模型 (一)数据库访问