标签:上传 path add code 没有 init name one spl
定义视图
1 #新建views1.py 2 #coding:utf-8 3 from django.http import HttpResponse 4 def index(request): 5 return HttpResponse("hello world") 6 7 #在urls.py中修改配置 8 from . import views1 9 url(r‘^$‘, views1.index, name=‘index‘),
URLCONFG
#只匹配“/python/1/”部分 http://www.baidu.com/python/1/?i=1&p=new
url(r‘^([0-9]+)/$‘, views.detail, name=‘detail‘),
url(r‘^(?P<id>[0-9]+)/$‘, views.detail, name=‘detail‘),
包含其他的URLCONFG
from django.conf.urls import include, url urlpatterns = [ url(r‘^‘, include(‘usertest.urls‘, namespace=‘usertest‘)), ]
标签:上传 path add code 没有 init name one spl
原文地址:https://www.cnblogs.com/huashengdoujiao/p/9366229.html