Django的URL正则表达式引擎失败(Django's URL regex engine

2019-10-18 12:45发布

Django的URL正则表达式引擎失败,我不知道为什么。 即使我的理智检查可怕的失败。

这里是我的urls.py

from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^a', 'placemyorder.views.home', name='home'),
)

我得到这个404错误:

Page not found (404)
Request Method: GET
Request URL:    http://[ip address]/a/
Using the URLconf defined in placemyorder.urls, Django tried these URL patterns, in this order:
1. ^a [name='home']
The current URL, , didn't match any of these.

当我访问

http://[ip address]/a

而且它托管在Django的1.5.2和Python 2.7.3在Ubuntu 12.04 Nginx的背后如果信息是相关的。

Answer 1:

这里有一个线索: The current URL, , didn't match any of these.

它应该说: The current URL, http://[ip address]/a, didn't match any of these.

所以调度员没有得到请求的URL。

看看这个解决方案:
Django的+ NGINX URL问题



文章来源: Django's URL regex engine is failing