Django's URL regex engine is failing

最后都变了- 提交于 2019-12-25 10:01:21

问题


Django's URL regex engine is failing and I have no idea why. Even my sanity checks are failing horribly.

Here's my urls.py:

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

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

I get this 404 error:

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.

when I visit

http://[ip address]/a

And it's hosted on Django 1.5.2 with Python 2.7.3 on Ubuntu 12.04 behind nginx if that info is relevant.


回答1:


Here's a clue: The current URL, , didn't match any of these.

It should say: The current URL, http://[ip address]/a, didn't match any of these.

So the dispatcher isn't getting the request url.

Take a look at this solution:
Django + NGINX URL Problem



来源:https://stackoverflow.com/questions/18390217/djangos-url-regex-engine-is-failing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!