1.项目urls.py
from django.conf.urls import url, include
urlpatterns = [
url(r'^', include('app01.urls', namespace='app01')),
]
2.app01.urls.py
from django.conf.urls import ur
from . import views
app_name = 'app01'
urlpatterns = [
url(r'tiaozhuan/(?P<username>\w+)/$', views.test, name='test'),
]
3.app01.views.py
from django.http import HttpResponse
def test(request, username):
print(username)
return HttpResponse('test')
4.浏览器访问后