我在URL.py文件Django的:從URL捕獲的數據將無法正常工作
(r'^confirm/(\d+)/$', confirm)
以下語句,但這個網址
http://127.0.0.1:8000/confirm/DMo32zPB15
返回此
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/confirm/DMo32zPB15
Using the URLconf defined in BBN.urls, Django tried these URL patterns, in this order:
^login/$
^ajax/login$
^ajax/login/nact/$
^ajax/login/nact/cancel//$
^ajax/login/nact/resend/$
^confirm/(\d+)/$
The current URL, confirm/DMo32zPB15, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file Change that to False, and Django will display a standard 404 page.
爲什麼它不會註冊URL嗎?
謝謝,我對「數字」的定義過於寬泛。我雖然因爲某些原因包含了字符。 – 2012-08-08 03:50:16
嗯,奇怪。即使文件現在讀取'(r'^ confirm /(\ [a-zA-Z0-9] +)/ $',確認)'它仍然會給出錯誤。 – 2012-08-08 03:52:39
你爲什麼要在那裏放一個反斜槓? '\ d +'被我建議的位取代。 – Amber 2012-08-08 03:54:57