Django
Relationship between URLS and VIEWS
BenzhaminKim
2020. 10. 29. 16:51
I'm going to explain how the url works with views.py
I put the angle bracket<> in the path as '<shortcode>'.
If I put http://localhost:8000/view1/sss to URL, 'sss' value is going to be a parameter from kirr_redirect_view function as a second parameter (shortcode).
If I put <sss> like below,
path('view1/<sss>',kirr_redirect_view),
def kirr_redirect_view(request,sss=None, *args, **kwargs):
print(args)
print(kwargs)
print(sss)
return HttpResponse("hello")
then the second parameter has to be same.
The below is the flow from Request to View.