【发布时间】:2021-10-20 20:48:17
【问题描述】:
在我的 URLs.py 中,我正在这样设置我的 URL
url(r'^mobile/$', views.mobile, name='mobile')
导航到 localhost:8000/mobile 可以正常工作,但如果输入 URL:localhost:8000/mobile/hello/world/234234hjhf8sc3,它应该重定向到 localhost:8000/mobile
但是这不会发生,因为我的正则表达式不正确(我不确定)
我该怎么做/正确的正则表达式是什么?
另一个例子是localhost:8000/mobile/send/help/as792lp 应该重定向到
localhost:8000/mobile
【问题讨论】:
标签: python django string redirect