Capturing URL parameters in request.GET

后端 未结 13 1032
说谎
说谎 2020-11-22 08:30

I am currently defining regular expressions in order to capture parameters in a URL, as described in the tutorial. How do I access parameters from the URL as part the

13条回答
  •  故里飘歌
    2020-11-22 08:51

    I would like to share a tip that may save you some time.
    If you plan to use something like this in your urls.py file:

    url(r'^(?P\w+)/$', views.profile_page,),
    

    Which basically means www.example.com/. Be sure to place it at the end of your URL entries, because otherwise, it is prone to cause conflicts with the URL entries that follow below, i.e. accessing one of them will give you the nice error: User matching query does not exist.

    I've just experienced it myself; hope it helps!

提交回复
热议问题