相思资源网 Design By www.200059.com
urls.py的配置写法一般有三种方式。
1. 第一种是导入视图的方式,就是 The Django Book 里面样例的写法:
from blog.views import index url(r'^nowamagic/', index)
2. 第二种方法是视图处理方法,看代码就知道是怎么回事了。
url(r'^nowamagic/', 'test.views.index')
3. 第三种是把模型与视图写在前缀里。
urlpatterns = patterns('blog.views', url(r'^nowamagic$', 'index' ) url(r'^nowamagic/\d{2}/$', 'index') url(r'^nowamagic/("htmlcode">from django.conf.urls.defaults import * urlpatterns = patterns('', # test_client modeltest urls (r'^test_client/', include('modeltests.test_client.urls')), (r'^test_client_regress/', include('regressiontests.test_client_regress.urls')), # File upload test views (r'^file_uploads/', include('regressiontests.file_uploads.urls')), # Always provide the auth system login and logout views (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), (r'^accounts/logout/$', 'django.contrib.auth.views.logout'), # test urlconf for {% url %} template tag (r'^url_tag/', include('regressiontests.templates.urls')), # django built-in views (r'^views/', include('regressiontests.views.urls')), # test urlconf for middleware tests (r'^middleware/', include('regressiontests.middleware.urls')), # admin view tests (r'^test_admin/', include('regressiontests.admin_views.urls')), (r'^generic_inline_admin/', include('regressiontests.generic_inline_admin.urls')), # admin widget tests (r'widget_admin/', include('regressiontests.admin_widgets.urls')), (r'^utils/', include('regressiontests.utils.urls')), # test urlconf for syndication tests (r'^syndication/', include('regressiontests.syndication.urls')), # conditional get views (r'condition/', include('regressiontests.conditional_processing.urls')), # middleware exceptions tests (r'middleware_exceptions/', include('regressiontests.middleware_exceptions.urls')), # special headers views (r'special_headers/', include('regressiontests.special_headers.urls')), )感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无Python urls.py的三种配置写法实例详解的评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。